-
10 Jan 2013 10:39 PM #1
How to delete the data in Store that's already filtered
How to delete the data in Store that's already filtered
Help me Please
How to delete the data in Store that's already filtered
I got two record where DefectId = CR01 from this filter actionCode:SharpJs.TrPenaltiesStore.filter('DefectId', 'CR01', false, true);
Then I want to remove the records
After process that code, all of data except that DefectId = 'CR01' is removedCode:SharpJs.TrPenaltiesStore.remove();
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 #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
store.removeAll() should remove all data, filtered or not filtered.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Jan 2013 5:12 PM #3
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 #4
One way of returning the filtered records is by attaching a function to the filtering, as seen in the API documentation:
http://docs.sencha.com/ext-js/3-4/#!...-method-filter
In the function, you could simply pass all the returned records to an array, then remove these when required.Code: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 } ]);
-
14 Jan 2013 6:36 PM #5


Reply With Quote