Opened 11 years ago

Closed 6 years ago

#7520 closed enhancement (wontfix)

ContentPane - loadModules option

Reported by: Les Owned by:
Priority: high Milestone: 1.8
Component: DojoX Layout Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

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 (5)

comment:1 Changed 11 years ago by dante

Component: GeneralDojox
Owner: changed from anonymous to Adam Peller

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.

comment:2 Changed 11 years ago by bill

Milestone: tbd2.0

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

comment:3 Changed 11 years ago by Adam Peller

Milestone: 2.0future

comment:4 Changed 8 years ago by Adam Peller

Owner: Adam Peller deleted

another for Bill

comment:5 Changed 6 years ago by bill

Component: DojoxDojoX Layout
Milestone: future1.8
Resolution: wontfix
Status: newclosed

A lot has changed in the past five years. Nowadays you can get the behavior you want via the parser's <script type="dojo/require">...</script> syntax.

Note: See TracTickets for help on using tickets.