Opened 11 years ago
Closed 7 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
Component: | General → Dojox |
---|---|
Owner: | changed from anonymous to Adam Peller |
comment:2 Changed 11 years ago by
Milestone: | tbd → 2.0 |
---|
Hmm, I don't expect getting a 1:1 module mapping before 2.0...
comment:3 Changed 11 years ago by
Milestone: | 2.0 → future |
---|
comment:5 Changed 7 years ago by
Component: | Dojox → DojoX Layout |
---|---|
Milestone: | future → 1.8 |
Resolution: | → wontfix |
Status: | new → closed |
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.
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:
is reliable. The Class-to-Module mapping prevents this in an automated fashion as well, to a degree.