Ticket #7520 (new enhancement)

Opened 10 months ago

Last modified 10 months ago

ContentPane - loadModules option

Reported by: Les Owned by: peller
Priority: normal Milestone: future
Component: Dojox Version: 1.1.1
Severity: normal Keywords:
Cc:

Description

I was wondering why there's no option for the ContentPane? to load modules referenced in the content. I think this would be a rather simple addition, see the (untested) code fragment below:

_createSubWidgets: function(){

// summary: scan my contents and create subwidgets if(this.loadModules) {

dojo.query('[dojoType]', this.domNode).forEach(function(node) {

var resource = dojo.attr(node, 'dojoType'); dojo.require(resource);

});

} try{

dojo.parser.parse(this.containerNode, true);

}catch(e){

this._onError('Content', e, "Couldn't create widgets in "+this.id

+(this.href ? " from "+this.href : ""));

}

}

Also, see this discussion: http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-development-discussion/contentpane-load-modules-option

Change History

Changed 10 months ago by dante

  • owner changed from anonymous to peller
  • component changed from General to Dojox

there are a number of places your example would fail: TooltipDialog (Dialog.js) DropDownButton + friends (Button.js) ... Unfortunately, there is not a 1:1 relationship between available classes for instantiation and the modules that provide them. If they should is a whole other issue, but it prevents this from being possible as-is. I can see value in this, however, its just not feasible in this context. It also may be "too much magic" if the parser or ContentPane started calling dojo.require() for you, but entirely possible especially in/after 1.2, where something like:

dojo.addOnLoad(function(){
    dojo.require("foo.bar.Baz");
    dojo.addOnLoad(function(){
        new foo.bar.Baz(); 
    });
});

is reliable. The Class-to-Module mapping prevents this in an automated fashion as well, to a degree.

Changed 10 months ago by bill

  • milestone changed from tbd to 2.0

Hmm, I don't expect getting a 1:1 module mapping before 2.0...

Changed 10 months ago by peller

  • milestone changed from 2.0 to future
Note: See TracTickets for help on using tickets.