I am developing a single-page web-application with Dojo 1.9.
We use the Dojo Parser to initialize widgets in HTML fragments loaded from the server into a dojox.layout.ContentPane.
Before we insert the ContentPane into the page, we want to wait until all of the widgets finish initialization completely.
Is there a way to do this?
I have been trying to achieve this by waiting on the promise returned by ContentPane.content but this seems to get resolved earlier.
var onParseEnd = pane.set("content", htmlText);
I think that onParseEnd gets resolved immediately after the parser has "parsed" the HTML content and not after all of the widget initializations have finished.
require (["dojo/parser"], function ( parser ){ parser.parse( html_fragment ).then(onComplete_Callback);});- frankonLoadDeferredonly waits for the content itself to load (in the case of settinghrefrather thancontent) and forparseto run (in case there were any new modules that needed to be required). Resolution isn't delayed for the script execution enabled bydojox/layout/ContentPane(actually handled bydojox/html/_base). It is ideally preferable to organize JavaScript into modules and templated widgets as necessary so that your code is well-organized and you don't end up at the mercy of loose scripts evaluated as part of mixed content. - Ken Franqueiro