admin管理员组文章数量:1309955
I need to find all dijit.form.CheckBox widgets inside a DIV and enable/disable them all. I am not able to form appropriate query for it.
I tried dojo.query("[dojoType~=dijit.form.CheckBox]")
but it gives me an empty list.
What is the appropriate query for it? Can DOJO query return a WidgetSet or does it always returns DOM ids? Is there some different way for querying dijit widgets?
I need to find all dijit.form.CheckBox widgets inside a DIV and enable/disable them all. I am not able to form appropriate query for it.
I tried dojo.query("[dojoType~=dijit.form.CheckBox]")
but it gives me an empty list.
What is the appropriate query for it? Can DOJO query return a WidgetSet or does it always returns DOM ids? Is there some different way for querying dijit widgets?
Share Improve this question asked Dec 11, 2009 at 8:38 Shailesh KumarShailesh Kumar 6,9778 gold badges37 silver badges60 bronze badges2 Answers
Reset to default 9Try dijit.findWidgets:
Search subtree under root, putting found widgets in outAry. Doesn't search for nested widgets (ie, widgets inside other widgets)
This is 1.7 > code and will search recursively for widgets instead of just direct descendents as is the case for findWidgets
need to require "dojo/query"
and optionally "dijit/registry"
var checkboxes = query("input[type=checkbox]:checked", "myForm");
checkboxes.forEach((function (checkbox) {
//dom node
console.log(checkbox);
//dijit
console.log(registry.byId(checkbox.id));
}));
This queries checked checkboxes underneath a dom node id myForm
and loops through the results and prints the element. Note that this only gives dom node elements in the result set so if you want to get the dijits you can use registry.byId(...)
本文标签: javascriptquery list of dijit checkboxes inside a DIVStack Overflow
版权声明:本文标题:javascript - query list of dijit checkboxes inside a DIV - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741859153a2401521.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论