-
18 Feb 2013 12:54 AM #1
Answered: Store's filter method is not working as expected
Answered: Store's filter method is not working as expected
I have a store which is having a model. Model contains three fields ID, Name, age. This store is attached to a grid.
This is how the data looks:
delete.PNG
I user filter function on the store to apply filter.
So when i apply filter on Id 'Manu', i see two results in grid myStore.filter('ID', 'Manu'); //Works fine
Problem myStore.filter('ID', 'Sales'); // retuns 4 results. It also includes result for ID 'Sales One' and 'Sales Two'
What I Want: When I filter on 'Sales' ID, it should return only results for ID 'Sales'.
-
Best Answer Posted by webfriend13
HI Mixo,
Thank you for quick reply. I will try the solution you gave but I tried this code and its working. I think your solution is same as below solution. +1 for that
. Thank you
Code:myStore.filter([ {filterFn: function(item) { return item.get('ID') == 'Sales'; }} ]);
-
18 Feb 2013 1:08 AM #2
webfriend13 you can define filter function for filter with conditions which you like
Code:store.filter([ {property: "email", value: /\.com$/}, {filterFn: function(item) { return item.get("age") > 10; }} ]);
-
18 Feb 2013 1:42 AM #3
HI Mixo,
Thank you for quick reply. I will try the solution you gave but I tried this code and its working. I think your solution is same as below solution. +1 for that
. Thank you
Code:myStore.filter([ {filterFn: function(item) { return item.get('ID') == 'Sales'; }} ]);


Reply With Quote