2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.wire.demos.WidgetRepeater"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.wire.demos.WidgetRepeater"] = true;
|
|
|
3 |
dojo.provide("dojox.wire.demos.WidgetRepeater")
|
|
|
4 |
|
|
|
5 |
dojo.require("dojo.parser");
|
|
|
6 |
dojo.require("dijit._Widget");
|
|
|
7 |
dojo.require("dijit._Templated");
|
|
|
8 |
dojo.require("dijit._Container");
|
|
|
9 |
|
|
|
10 |
dojo.declare("dojox.wire.demos.WidgetRepeater", [ dijit._Widget, dijit._Templated, dijit._Container ], {
|
|
|
11 |
// summary:
|
|
|
12 |
// Simple widget that does generation of widgets repetatively, based on calls to
|
|
|
13 |
// the createNew function and contains them as child widgets.
|
|
|
14 |
templateString: "<div class='WidgetRepeater' dojoAttachPoint='repeaterNode'></div>",
|
|
|
15 |
widget: null,
|
|
|
16 |
repeater: null,
|
|
|
17 |
createNew: function(obj){
|
|
|
18 |
// summary:
|
|
|
19 |
// Function to handle the creation of a new widget and appending it into the widget tree.
|
|
|
20 |
// obj:
|
|
|
21 |
// The parameters to pass to the widget.
|
|
|
22 |
try{
|
|
|
23 |
if(dojo.isString(this.widget)){
|
|
|
24 |
dojo.require(this.widget);
|
|
|
25 |
this.widget = dojo.getObject(this.widget);
|
|
|
26 |
}
|
|
|
27 |
this.addChild(new this.widget(obj));
|
|
|
28 |
this.repeaterNode.appendChild(document.createElement("br"));
|
|
|
29 |
}catch(e){ console.debug(e); }
|
|
|
30 |
}
|
|
|
31 |
});
|
|
|
32 |
|
|
|
33 |
}
|