TabContainer 中特定 ContentPane 的 Dojo 查询
我有一个带有不同选项卡(ContentPanes)的 TabContainer。当用户从树中选择某些内容时,我会动态加载每种类型。我希望能够在新加载的 ContentPane/Tab 上运行某个 JS 函数。所以这种形式的东西:
dojo.forEach(
dojo.query("select"),
function(selectTag) {
selectTag.disabled = true;
}
);
但是,我只想在新加载的 ContentPane/Tab 上处理这个...所以假设给定一个 ContentPane/Tab Dojo 对象,我如何仅对其内容执行 forEach/query ?
谢谢
I have a TabContainer with different tabs (ContentPanes). I am loading each type dynamically when the user selects something from a tree. I would like to be able to run a certain JS function on the newly loaded ContentPane/Tab. So something in this form:
dojo.forEach(
dojo.query("select"),
function(selectTag) {
selectTag.disabled = true;
}
);
However, I only want to process this on the newly loaded ContentPane/Tab... so let's say given a ContentPane/Tab Dojo Object, how do I do a forEach/query on its content only?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以为 dojo.query 提供第二个参数,告诉它从哪个 DOM 节点开始查找。因此,如果您有一个 ID 为“fooTab”的 ContentPane,您可以这样做:
现在,从技术上讲,“fooTab”是“dijit ID”,但 dijit/ContentPane 的最外层 DOM 节点也将有一个 id“fooTab”。也许不是犹太洁食方式,但它确实有效。
You can give
dojo.query
a second argument telling it in which DOM node to start looking. So if you have a ContentPane with id "fooTab", you can do:Now, technically, "fooTab" is the "dijit ID", but the dijit's/ContentPane's outermost DOM node will also have an id "fooTab". Perhaps not the kosher way, but it works.