View Full Version : How to delete the data in Store that's already filtered

10 Jan 2013, 10:39 PM
Help me Please

How to delete the data in Store that's already filtered

SharpJs.TrPenaltiesStore.filter('DefectId', 'CR01', false, true);

I got two record where DefectId = CR01 from this filter action
Then I want to remove the records


After process that code, all of data except that DefectId = 'CR01' is removed
I want to keep that data but it's removed from the store and the data that I want to remove is still keep in the store.
How to handle this? Please help me Thanks

13 Jan 2013, 9:31 AM
store.removeAll() should remove all data, filtered or not filtered.

13 Jan 2013, 5:12 PM
But I don't want to remove all data
I just want to remove the data that's already filtered and want to keep the others record in the store.
Still confuse with it
Because when I read to the store when it's filtered I got the right record (all record that DefectId ='CR01')
But when I process the .remove function the data that's remove not same with what I read
The data that's remove from the store is all the data in the store except CR01.
So after process remove I just got the filtered data. But it's different with what I want.
Actually I want to remove the record that's already filtered and keep the others, but I got remove the others and keep the filtered record.

14 Jan 2013, 2:00 AM
One way of returning the filtered records is by attaching a function to the filtering, as seen in the API documentation:

store.filter([ {
property : 'name',
value : 'Ed',
anyMatch : true, //optional, defaults to true
caseSensitive: true //optional, defaults to true

//filter functions can also be passed
fn : function(record) {
return record.get('age') == 24
scope: this
In the function, you could simply pass all the returned records to an array, then remove these when required.

14 Jan 2013, 6:36 PM
Thanks willigogs
Your posting really helpful