Login Register

dojo.query fails on content loaded via dijit.layout.contentPane or dojox.layout.contentPane

New to dojo. I intended to put together a documentation system using many existing html docs, similar to the ExtJS API docs. The external docs are all largish, valid html fragments. The docs will load fine using:

   // center or main sub-container
   var mainCP = new dojox.layout.ContentPane({
      id:            'mainCP',
      region:        'center',
      href:          'content/modules/DipFilter.html',
      style:         'padding-left: 1em;',
      refreshOnShow: true,
      parseOnLoad:   false,
      preventCache:  true,
      executeScripts:false
   }, document.createElement("div"));

The html fragments contain no dojo markup. At the end of the dojo.onPageLoad function, something like:

dojo.query('toolbar_1');

returns an empty array, while <div id="toolbar_1"></div> does exist in the doc. With: dojo.query('#mainCP'), I get the HTMLDivElement created for the contentPane, but can't seem to get past it. This may be the same as bug: http://trac.dojotoolkit.org/ticket/3849. If so, could someone confirm? It has been pushed to ver1.3 and is a bit of a show stopper for me, as I don't want to modify all the existing docs. If this is the case, could someone elaborate in a few lines on the suggested workaround?
"the workaround here is to specify innerHTML on a container after using the dojox XML DOM serialization function:"

thks

you should run the

you should run the dojo.query after you are sure that the content is loaded which should be something like

.... new dijit.layout.ContentPane({
....
onLoad: function(){
dojo.query('toolbar_1');...
},
....
});

Greetings,

Nikolai

That got me going again

That got me going again Nikolai. I picked a bad time to try dojo, with the api documentation being offline (am Linux-only so can't use the offline stuff).

Thanks a lot.