PDA

View Full Version : Filtering Grid?



alejandroNNU
14 Nov 2013, 6:51 AM
Hey all,

I have a grid panel with two columns, "service" and "status" which contains a list of services and their status can be either active, inactive, disabled or retired, now if I want to filter the content and have it only show me the services with a certain status, lets say all the services which are active right now, what would be the best way to go about this?

MikeRH
14 Nov 2013, 7:39 AM
See the section on filtering here http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store its pretty straight forward.

alejandroNNU
14 Nov 2013, 9:17 AM
got it, thank you, just one more question, my store is called "ServiceStore", I want to call store.filter('service', 'active') when I click on a button, however since the store doesn't have a itemID I' don't know how to reference it in my code, for example:


var store = Ext.ComponentQuery.query('#ServiceStore')[0].getValue();
store.filter('service', 'active');

doesn't work, so how can I reference the ServiceStore so I can call filter on it?

tobiu
14 Nov 2013, 9:32 AM
only views are extending Ext.Component, so the component queries are not available for stores.

the easiest way is using:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext-method-getStore

you could also set up an event domain inside your controller to fetch events there.