PDA

View Full Version : [FIXED] [PR1] Localstorage - Calling Store.removeAll() doesn´t remove anything.



SunboX
24 Nov 2011, 12:51 AM
REQUIRED INFORMATION

Ext version tested:

Sencha Touch 2.0PR1

Browser versions tested against:


Safari 5 (iPhone 3GS /w iOS 5)

Description:

I have an Ext.data.Store bound with an Model + LocalStorage Proxy.
If I call "removeAll()" on this store, nothing happens. The profiler shows all store entries, like before.
If I call instead "Store.getProxy().clear()" all items get remove (like I expected "removeAll() will do".

mitchellsimoens
25 Nov 2011, 9:42 AM
Did you do a sync() after removing the records from the Store?

SunboX
25 Nov 2011, 10:15 AM
Yes, but I did add some items before. Like this:



store.removeAll();
Ext.Array.each(arr, function(item){
store.add({ foo: item });
});
store.sync();


greetings Sunny

yoh.suzuki
5 Jan 2012, 2:46 PM
I hacked around it for now by overriding the store's clearData function like this:


clearData: function() {
var me = this;

me.removed || (me.removed = []);
me.data.each(function(record) {
record.unjoin(me);

// the proxy won't know to remove these unless it's added to the removed list
me.removed.push(record);
});

me.data.clear();
}

(This may not be the best way to do this, but it's a temporary fix that's working for me.)

TommyMaintz
16 Jan 2012, 2:52 PM
This has been fixed as part of the next Touch 2.0 release. Thanks for the reports!