ExtJS隐藏所有子组件 [英] ExtJS hide all child components

查看:154
本文介绍了ExtJS隐藏所有子组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

Ext.Array.each(myContainer.query('> *'), function(cmp) { cmp.hide(); });

有更好的方法吗?

推荐答案

您的方法使用一个需要更多资源的查询。一个更有效的方式可能只是:

Your approach uses a query which takes more resources. A more efficient way may be just:

Ext.each(myContainer.items.items, function(cmp) { cmp.hide(); });

由于您已经有了对myContainer的引用,所以没有必要查询其子项,因为您已经有访问它们。

Since you already have a reference to myContainer, there's no point of querying for its children as you already have access to them.

如果你想要更高效,你也可以编写自己的for循环,并跨越 myContainer.items.items

If you want it even more efficient, you can also write your own for loop and iterate across myContainer.items.items.

这篇关于ExtJS隐藏所有子组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆