ExtJS hide all child components [duplicate]

ε祈祈猫儿з 提交于 2019-12-11 19:01:44

问题


Consider:

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

Is there a better way?


回答1:


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(); });

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

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



来源:https://stackoverflow.com/questions/22050546/extjs-hide-all-child-components

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!