Opened 6 years ago

Closed 6 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)

test.zip (2.9 KB) - added by Joel_Mckay 6 years ago.
main page for testing

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by bill

Owner: changed from bill to Joel_Mckay
Status: newpending

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.

Changed 6 years ago by Joel_Mckay

Attachment: test.zip added

main page for testing

comment:2 Changed 6 years ago by Joel_Mckay

Status: pendingnew

Attachment (test.zip) added by ticket reporter.

comment:3 Changed 6 years ago by Joel_Mckay

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 6 years ago by bill

Status: newpending

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 6 years ago by Joel_Mckay

Status: pendingnew

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 6 years ago by bill

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.