What is the difference between dojoAttachpoint and id.

<div dojoType="dojo.Dialog" id="alarmCatDialog" bgColor="#FFFFFF" bgOpacity="0.4" toggle="standard"> <div class='dijitInline'> <input type='input' class='dateWidgetInput' dojoAttachPoint='numberOfDateNode' selected="true" /> </div> 

how to show this dialog I tried dijit.byId('alarmCatDialog').show();

The above code is a template, and I called dijit.byId('alarmCatDialog').show() from a .js file.

0
source share
1 answer

dojoAttachPoint used in the template and can be accessed in widgets using the attribute value.

So, if the html you posted is used in the widget template, you should use dojoAttachPoint . In the js file for the widget:

 dojo.declare("MyWidget", [dijit._Widget, dijit._Templated], { alarmCatDialog: null, // the dialog widget will be attached to this field. templateString: dojo.cache(...), widgetsInTemplate: true, postCreate: function() { this.inherited(arguments); this.alarmCatDialog.show(); } }); 

You should not use id in widgets, because identifiers must be unique for all dom nodes. Using it in widgets limits the use of your widget on the page.

Also, since there are widgets in your template, you should use widgetsInTemplate: true

http://dojotoolkit.org/reference-guide/1.7/dijit/_Templated.html#widgetsintemplate

+1
source

All Articles