0

I have the following code in DOJO1.6 and DOJO1.4. In 1.6 version it is working fine but but is not working in 1.4. The tabbed menus are getting displayed as just list. Please help me so that the code works fine in DOJO1.4 also.

<script src="/portal_dojo/v1.4.3/dojo/dojo.xd.js" djConfig="parseOnLoad:true">
</script>
<script type="text/javascript">
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
</script>
<div style="width: 350px; height: 300px">
<div data-dojo-type="dijit.layout.TabContainer" style="width: 100%; height: 100%;">
    <div data-dojo-type="dijit.layout.ContentPane" title="My first tab" selected="true">
        Lorem ipsum and all around...
    </div>
    <div data-dojo-type="dijit.layout.ContentPane" title="My second tab">
        Lorem ipsum and all around - second...
    </div>
    <div data-dojo-type="dijit.layout.ContentPane" title="My last tab" closable="true">
        Lorem ipsum and all around - last...
    </div>
</div>

1 Answers1

0

Support for HTML5 style data-dojo-xyz attributes were added in 1.5, so they won't be recognized by Dojo 1.4.

So instead of data-dojo-type="dijit.layout.TabContainer" you have to use dojoType="dijit.layout.TabContainer" (and equivalent for ContentPane, of course) for Dojo 1.4.

See example here: http://jsfiddle.net/froden/WyeRk/

Frode
  • 5,600
  • 1
  • 25
  • 25
  • @user1129605 Check out the jsfiddle link. Does it work in your browser? What are the differences between the jsfiddle and your code? Perhaps you can paste more of your code here. Are the tabs not instantiated at all, or do they just look wrong? – Frode Jan 20 '12 at 11:35
  • My code is working in JSfiddle. But not in my system. If I have three tabs with test as tabone, tabtwo and tabthree..I get the following in output in a plain html page: tabone tabtwo tabthree in different lines. Thats all. – user1129605 Jan 22 '12 at 03:51
  • @user1129605 Hmm, very strange. It sounds like the TabContainer isn't being instantiated, but it's hard to tell why. Other dijits are working, and there are no errors in the Javascript console? – Frode Jan 22 '12 at 16:22
  • I am not using any other widgets. I get a js error as '; expected' when I include dojo.xd.js. But I could not find where ; is missing. – user1129605 Jan 23 '12 at 03:47
  • @user1129605 Ah, interesting. I'm noticing that you are using the cross-domain version (xd), even though you have a local copy of Dojo. Could that be related? Have you tried using just dojo.js instead? – Frode Jan 23 '12 at 12:01