ExtJS. Hide all components within a container

≡放荡痞女 提交于 2019-12-30 07:11:23

问题


I have a window in which I am rendering a number of components like panels etc.

Is there a way I can hide all the components contained in window without having to hide them individually? Something like,

Ext.getComponent('myWindow').hideAllComponents();

I am using extjs 3.4.


回答1:


If I understood you right, you do not want to hide your window, but the elements in your window. So can do this:

// get window, get element, get all direct children with css selector '*'
var children = Ext.get('myWindow').getEl().down('*')

// hide them all
Ext.each(children,function(child){child.hide();});



回答2:


Try setting style for your container

Ext.get('myWindow').setStyle('display','none');



回答3:


Assuming myWindow is a reference to your window, you can use:

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

The other answers mention Ext.get but that retrieves DOM elements, not components.

See also: ExtJS hide all child components



来源:https://stackoverflow.com/questions/17314156/extjs-hide-all-components-within-a-container

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