Opened 9 years ago
Closed 9 years ago
#16896 closed defect (invalid)
dynamic load of dijit.layout.TabContainer causes "TypeError: Menu is not a constructor"
Reported by: | Joel_Mckay | Owned by: | Joel_Mckay |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
This occurs when the code is dynamically loaded, .parse(), and a js shim is called to process the <script>. It appears to function normally for StackContainer?, but throws a rather odd TabContainer? type error.
I can't seem to trace it with FF 19.0.2 & firebug 1.11.2, and insights into the issue would be appreciated.
Cheers, J
<div style="width: 350px; height: 300px"> <div id="tabber"></div> </div> <script> // This is called after te libs finish load function showContentWizardArea() { var tabnode = dojo.byId("tabber"); var tc = new dijit.layout.TabContainer({ // Todo Debug Error: TypeError: Menu is not a constructor // Source File: http://127.0.0.1/js/dojo/dojo.js // Line: 458 style: "height: 100%; width: 100%;", id: "myTabContainer" }, tabnode ); /* //this works fine tc = new dijit.layout.StackContainer({ style: "height: 100%; width: 100%;", id: "myTabContainer" }, tabnode ); */ var cp1 = new dijit.layout.ContentPane({ title: "bug off", content: "it should work by now", selected: true }); tc.addChild(cp1); tc.startup(); } //called by shim function dbootstrap() { //stacked box dojo.require("dijit.layout.StackController"); dojo.require("dijit.layout.StackContainer"); //Tabbed box dojo.require("dijit.layout.TabContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.registry"); dojo.require("dojo.ready"); //load gui after libs ready dojo.ready( function (){ showContentWizardArea(); }); } </script>
Attachments (1)
Change History (7)
comment:1 Changed 9 years ago by
Owner: | changed from bill to Joel_Mckay |
---|---|
Status: | new → pending |
comment:2 Changed 9 years ago by
Status: | pending → new |
---|
Attachment (test.zip) added by ticket reporter.
comment:3 Changed 9 years ago by
The test case is a flattened version of dynamic auto generated code.
It is rather an odd way of using dojo, and I have been upgrading the back-end for 1.8.3 ...
Cheers, J
comment:4 Changed 9 years ago by
Status: | new → pending |
---|
Yah... I tried that test case. After removing:
<script type="text/javascript" src="dijit/dijit.js" data-dojo-config="parseOnLoad: true"></script> <script type="text/javascript" src="dijit/dijit-all.js" charset="utf-8"></script>
it seems to work fine. I think the lines above are illegal because with AMD you can't just inject your own scripts whenever you want. After removing those lines do you have any other issue?
comment:5 Changed 9 years ago by
Status: | pending → new |
---|
Thanks for the help Bill, it works and the classes seem to behave better.
I had commented out each line individually, but was unaware these could both be excluded from inclusion. Unfortunately, I don't seem to be able to close tickets myself... =)
Cheers, J
comment:6 Changed 9 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Not sure what's going on, although you are loading dojo in a strange way, putting the dojo.require() calls inside a function.
Anyway, please attach a running test case (rather than a code snippet) using the "Attach file" button.