-
1 Feb 2008 9:24 AM #1
GridPanel, GroupingStore and store.filter
GridPanel, GroupingStore and store.filter
How do you go about applying multiple filters to a store?
I've tried
If the name was the only item being filtered, things would be ok, but if it is a case where multiple filters were run on the store, only the last filter would be executed. Is there anyway to filter on the current snapShot of the store?Code:store.filter('name', nameValue); store.filter('status', statusValue);
-
2 Feb 2008 2:53 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Just use filterBy, e.g.
Code:store.filterBy(function(record, id) { return (record.get('name') == nameValue) && (record.get('status') == statusValue); });
-
3 Apr 2009 3:32 AM #3
store filter problem
store filter problem
Hi all,
I have very basic question.
I can't make filters work.
I am using a grid and i like the grid to display only rows with 'install' string in the column 'type'.
I am using the data store in grid and this is the code for the data store:
function loadDataStore(){
var store = new Ext.data.Store({
url: 'url.do',
reader: new Ext.data.JsonReader({
root:'rows',
totalProperty: 'results',
id:'id'
}, [
'id',
{name: 'date', type: 'date', dateFormat: 'd/m/Y'},
'event',
'by',
'type',
'description',
'status'
])
});
store.load();
store.filter('type', 'Install');
return store;
}
Can anybody help me.
Thanks!
-
3 Apr 2009 4:07 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
You forgot that loading is asynchronous.
Calling load() sends a request to the server, but the records won't be loaded until the response is received from the server.
Try:
Code:store.load({ callback: function(){ store.filter('type', 'Install'); } });
-
3 Apr 2009 4:16 AM #5
-
11 Sep 2009 6:14 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
I don't understand. Can you rephrase the question?
-
20 Oct 2009 11:20 PM #7
I combine tehnique in here:
http://www.extjs.com/forum/showthread.php?t=66005 with code-snippet above...
to filter based on the generated-field (ajax)
But it doesn't work....
only for previously loaded store then it works.
Any clues?
-
21 Oct 2009 12:18 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
I don't completely understand your problem...
But for the original problem:
Loading a store and then filtering it can be slow when a component (dataview, grid etc.) is attached, because all rows are rendered before they are filtered. That is why I requested persistent store filtering.


Reply With Quote