OpenAjax Widget Developer Notes

From MemberWiki

Jump to: navigation, search

This wiki page contains supplemental widget developer tips and guidelines beyond what is in the OpenAjax Metadata 1.0 Specification.

Dojo afterOnLoad

For some Dojo widgets, it is necessary to take advantage of a feature that was introduced in Dojo 1.2 to allow an application to get a callback when all of the dojo.requires() that are needed by the application are available.

The Dojo technique involves setting:

<preload>
djConfig = { afterOnLoad: true );
</preload>

and then within the onLoad callback:

MyClass = function() {};
MyClass.prototype.onLoad = function() {

   dojo.require(...);
   dojo.require(...);
   dojo.addOnLoad(function() {
      // Most initialization logic happens here
      // Don't want this logic to run until after
      // all of the Dojo modules we need have been loaded.
   }
}
Personal tools