PDA

View Full Version : [FIXED-189] Store 'datachanged' even firing twice



tobinharris
4 Jul 2010, 4:56 AM
I have a store declared as:



MyProj.Data.Cards = new Ext.data.Store({
model: 'Card'
proxy: new Ext.data.LocalStorageProxy({
id: 'cards-proxy'
})
});
Then I attach a hook to the Store to get notified when it changes.



MyProj.Data.Cards.on('datachanged',function(){alert('it changed');});
Then I load some data in:



MyProj.Data.Cards.loadData(someData);
For some reason the datachanged is firing twice. I've looked at the Sencha source and I can't see why this is happening at all.

In fact, even if I do this I still get the same problem.



MyProj.Data.Cards.suspendEvents();
MyProj.Data.Cards.loadData(found,false);
MyProj.Data.Cards.resumeEvents();
Any help appreciated.

T

meyerovb
22 Jul 2010, 1:36 PM
This seems like a bug: Ext.data.Store.loadRecords loads the data, executes a call to Ext.data.Store.filter, and then fires the datachanged event. However, the call to the filter method is this.filter(); when it should be this.filter(null, true); in order to suppress the datachanged event from firing in the filter method as well.

tobinharris
23 Jul 2010, 5:01 AM
Thanks!

Jamie Avins
30 Jul 2010, 10:34 AM
Your issue has been entered in trac, thank you for the report.

edspencer
3 Sep 2010, 6:48 PM
Thanks for the report, this has now been fixed and will be present in the next release.

tobinharris
3 Sep 2010, 11:38 PM
Great, thanks for fixing, and for the feedback :)