Clear all records from a store
Question
I have a store, I am loading records from it successfully. Now i need to clear all the records in it. How can i do this ?
myStore.remove(); // DID NOT WORK
myStore.clear(); // ENDED UP WITH AN ERROR TypeError: myStore.clear is not a function
How could i solve this?
Solution 3
myStore.loadData([],false);
is the solution.
OTHER TIPS
Remove will remove the records you pass in. You want removeAll as in myStore.removeAll();
I find out that, at least on ExtJS 4.2.3, removeAll give an error the first time it is issued after a load. I got it resolved by doing:
store.clearData();
store.removeAll();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow