View Full Version : Difficulty removing records from store

5 Dec 2011, 2:21 PM
I have a store from which I need to remove certain records before I display the data. The store is loaded, and I can iterate over the set, but I am having trouble calling remove() on the appropriate records. If I read the set into a variable, I can make the necessary deletions, but the iteration is really slow.

var s = this.getStore('myStore');
s.each(function(record) {
changed = true;


... and if I chain the methods, I can't seem to access the record.

this.getStore('myStore').each(function(record) {

Am I missing something simple or am I going about this the wrong way? Thanks for your help.

5 Dec 2011, 2:27 PM
Is the store loaded?

5 Dec 2011, 3:37 PM
well, there are 2 options:

1) put all records you want to remove into an array and call store.remove() once with that array. this way all the view listeners (dom sizing etc.) will only get fired once.

2) for me it looks like you actually want to filter the store. so take a look at:

6 Dec 2011, 5:39 AM

I think you are right. The filterBy() method is much faster than each(). Do you know why that is?

In any case, thanks for your help. :D