PDA

View Full Version : How to find every component of an xtype?



pret
11 Feb 2011, 6:23 AM
Hi all,

I want to find every store of an xtype on the page. I don't want to use ID's because I can have lots of stores of a defined xtype, and I want to, for example, update every store of a module if an item is created / modified or deleted. And I want to reuse this behaviour with all my modules.

I don't have a main container. I have a desktop like app with windows, so I can't use a "findByType" method to find childrens of a defined xtype.

Is there a method like findByType, but that looks for every store (or other components) in the app? I've looked on the API but I couldn't find anything like this.



Thanks in advance!

johnathanhebert
11 Feb 2011, 9:31 AM
You can get a MixedCollection of all components by filtering by xtype

grids = Ext.ComponentMgr.all.filterBy(function(item){
return item.getXType()=="grid";
});

pret
11 Feb 2011, 10:26 AM
Nice tip! thanks a lot :)