[EDIT: Moved to the Dijit Support forum, this is a question about Dijit.]
Hi,
I having trouble creating a contentpane in a tab container to be lazyloading, if I produce it programmatically.
I can get it to work if I include the HTML code in the page itself without a problem.
Here is the code I am using:
var admin_tab = new dijit.layout.ContentPane({title:'Admin', parseOnLoad :'false', preload:'false', href:'/admin/index.html', id:'tabAdmin'}, dojo.doc.createElement('div'));
dijit.byId('tabContainer').addChild(admin_tab);
admin_tab.startup();But no matter what I try, the page /admin/index.html is always getting called upon startup as well as when the tab is clicked..
Any help would be greatly appreciated.
Thanks,
Ian

I see this is very similar
I see this is very similar to -
http://www.dojotoolkit.org/forum/dojo-0-4-x-legacy/dojo-0-4-x-support/pa...
But unfortunately the
"contentpane.isLoaded = true before adding that to pagecontainer"
trick isn't working for me. It's still being called twice.
Thanks,
Ian
Have You Tried
... Leaving out the href from the constructor, then doing a contentpane.setHref("/admin/index.html"); when you want it to load?
Thanks for the tip - I ended
Thanks for the tip - I ended doing this, bit of a long way around but doesn't look like I have any other choice!
On the dojo.addOnLoad -
var tabContainer = dijit.byId('tabContainer'); var handle = dojo.connect(tabContainer,"selectChild" ,function(event){ if(event.id=="tabAdmin") { if(dijit.byId('tabAdmin').href=='') { // Lazy load the contents of the Admin page dijit.byId('tabAdmin').setHref("/Admin/"); } } });