source: Dev/branches/rest-dojo-ui/client/dojox/wire/demos/WidgetRepeater.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.1 KB
Line 
1dojo.provide("dojox.wire.demos.WidgetRepeater")
2               
3dojo.require("dojo.parser");
4dojo.require("dijit._Widget");
5dojo.require("dijit._Templated");
6dojo.require("dijit._Container");
7
8dojo.declare("dojox.wire.demos.WidgetRepeater", [ dijit._Widget, dijit._Templated, dijit._Container ], {
9        //      summary:
10        //              Simple widget that does generation of widgets repetatively, based on calls to
11        //              the createNew function and contains them as child widgets.
12        templateString: "<div class='WidgetRepeater' dojoAttachPoint='repeaterNode'></div>",
13        widget: null,
14        repeater: null,
15        createNew: function(obj){
16                //      summary:
17                //              Function to handle the creation of a new widget and appending it into the widget tree.
18                //      obj:
19                //              The parameters to pass to the widget.
20                try{
21                        if(dojo.isString(this.widget)){
22                                // dojo.require(this.widget);   confuses new AMD builder, include resource manually first
23                                this.widget = dojo.getObject(this.widget);
24                        }
25                        this.addChild(new this.widget(obj));
26                        this.repeaterNode.appendChild(document.createElement("br"));
27                }catch(e){ console.debug(e); }
28        }
29});
Note: See TracBrowser for help on using the repository browser.