PDA

View Full Version : Remove store records from other store



Romick
29 Dec 2011, 5:49 AM
Hello guys!

I have a little problem. I have two store. userStore and allUserStore.
I load allUserStore only when user click a button.
But when he click i need to remone records form allUserStore which exist in userStore.
I do that the following code:


allUserStore.on('load', loadFunc = function(){
userStore.each(function(record){
this.removeAt(this.find('id', record.data.id));
}, this);
this.un('load', loadFunc);
});
allUserStore.load();

But problem is that it takes to long (nearly 17 seconds 100 users, 200 allUser)
Is there a faster way to remove store records from other store?

scottmartin
29 Dec 2011, 9:12 AM
Is this a remote store? I would think it would be better to issue an ajax request to the server (sending a json of all the id's) and remove the records using SQL rather than looping through each record.

Regards,
Scott.

Romick
29 Dec 2011, 2:22 PM
Yes it is a remote strore. I will do as you recommend. Thanks.