Reputation: 14144
One uses data-dojo-attach-point as a unique identifier (analog of ID) in order to access particular widget-element inside particular instance of the widget.
Is there any class-like analog one could use?
For example there is a widget Foo and its instances Foo1, Foo2, Foo3 etc. And each Foo has 10 Dijit/Form/TextBox elements and a button.
The aim is to change all 10 buttons with 1 line of code. One would simply add a class to each of 10 elements and use Dojo/Query to access each of them.
or
Is it possible to add class to a widgets (Diji/Form/TextBox) (not its DomNode). So when one uses Dojo/Query - it would list all elements of the current instance of the widget.
Upvotes: 0
Views: 302
Reputation: 339
yes you can attach the class to widget there are many ways
baseclass:'someWidgetClass';
data-dojo-props="class:'someWidgetClass'
Upvotes: 1
Reputation: 121
OK give each Foo widget a unique html id (ex. #Foo1), this will override the auto-generated ID done by Dijit. Next give each TextBox widget within the Foo widget a class="Foo_TB". Then you can use dojo.query("#Foo1 .Foo_TB'"); to return all the TextBox widgets in Foo1.
Upvotes: 1