giorgian
giorgian

Reputation: 3825

legacy dojo 1.1 - dojo.addOnLoad fires when dijit stuff is not ready

I'm forced to use dojo 1.1 on a site.

The page uses dijit widgets in declarative way, as in:

<select dojoType="dijit.form.FilteringSelect">...</select>

I want to do some stuff on widgets after load, but if I do:

dojo.addOnLoad(function() {
  dijit.registry.forEach(function(widget, idx, hash) {
    alert('Hello! I am a widget!');
  });
});

no alerts appear, as this code is execuded before the "dijitification" of the page, as I found out while debugging.

Is there a way to execute my code when the page is really, really ready?

Upvotes: 1

Views: 404

Answers (1)

giorgian
giorgian

Reputation: 3825

Just in case I (or anyone else) need it again, this is how I solved this:

dojo.addOnLoad(function() {
  dojo._loaders.push(someFunction);
});

This seems to ensure that someFunction is executed after all other callbacks, included dijit callbacks.

Upvotes: 1

Related Questions