如何在 ExtJs 面板中搜索子项
如何使用子项的 id 查找面板中是否存在特定子项(项目)。
假设我有一个父面板 (id =parentPanel
) 和几个面板作为该父面板的项目。现在,我想搜索 id 为“childPanel09
”的面板是否是父面板的子面板。
[可能不使用迭代]
注意:我正在使用 ExtJs 3.4
How can I find if a particular child (item) exists in a panel using the id of the child.
Say I have a parent paned (id = parentPanel
) and few panels as items of this parent panel. Now, I would like to search if a panel by id 'childPanel09
' is a child of parent panel.
[Possibly without using iteration]
Note: I am using ExtJs 3.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只想在parentPanel的直接子级中搜索,可以使用 getComponent:
如果您不仅想在直接子级中搜索,而且想在parentPanel下的任何层中搜索,您可以使用查找:
If you want to search only among direct childs of parentPanel you can use getComponent:
If you want to search not only among direct childs but at any layer under the parentPanel you can use find:
Ext.Container.find()
(来自已接受的答案)很好 自 ExtJS 3.4 起(这就是问题所问的内容)。然而,在 ExtJS 4.0 及更高版本中,find()
被删除,取而代之的是 Ext.Container.query(),它完成同样的事情。Ext.Container.find()
(from the accepted answer) is fine as of ExtJS 3.4 (which is what the question asked about). However, in ExtJS 4.0 and above,find()
was removed in favour of Ext.Container.query(), which accomplishes the same thing.