Hi How to name and destroy instance of the object?
Please see my working in jsfiddle
declare("obj_Button", [_WidgetBase], {
buildRendering: function () {
// create the DOM for this widget
this.domNode = domConstruct.create("button", {
innerHTML: "New Button Instance"
});
}
});
on(dom.byId('btn1'), "click", function(evt)
{
(new obj_Button()).placeAt(dom.byId('id'));
//name the instance
});
parser.parse(); // check out more!
on(dom.byId('btn2'), "click", function(evt)
{
// destroy the instance by name, not object
});
Please advise. Thanks
If you know the ID of the widget, you can use “dijit/registry” to get the widget, then destroy it:
If you only know the ID of the dom node, you can registry.findWidgets() (if the widget is a child of the dom node) or registry.getEnclosingWidget() (if the dom node is a child of the widget).
See http://dojotoolkit.org/reference-guide/1.8/dijit/registry.html#finding-all-widgets-underneath-a-dom-node