PDA

View Full Version : [FIXED] Sync() not removing items from localstorage



diesalher
30 Nov 2011, 9:35 AM
REQUIRED INFORMATIONversion tested:

Sencha Touch 2 PR2
Browser versions tested against:

Chrome 15.0.874.121
DOCTYPE tested against:

<!DOCTYPE html>
Description:

sync() not removing items from localstorage
Steps to reproduce the problem:

Add 2 items to localstorage
Remove the items
The result that was expected:

0 items in localstorage
The result that occurs instead:

2 items in localstorage
Test Case:
Ext.define('Search', {
extend: 'Ext.data.Model',
fields: ['id', 'query']
});


//our Store automatically picks up the LocalStorageProxy defined on the Search model
var store = Ext.create('Ext.data.Store', {
model: "Search",
proxy: {
type: 'localstorage',
id : 'test-Searches'
}
});


//loads any existing Search data from localStorage
store.getProxy().clear();
store.load();
console.log("total items:"+store.getCount()); // 0 items..ok.

store.add({query:'query 1'});
store.sync();
store.add({query:'query 2'});
store.sync();
store.removeAt(0);
store.sync();
store.removeAt(0);
store.sync();
console.log("total items:"+store.getCount()); // 0 items..ok.


store.load();
console.log("total items:"+store.getCount()); // 2 items ...aarghHELPFUL INFORMATIONDebugging already done:

none
Possible fix:

not provided
Additional CSS used:

only default ext-all.css
custom css (include details)
Operating System:

Windows 7 Enterprise 64

Jamie Avins
30 Nov 2011, 10:08 AM
Thank you for the report.

SunboX
2 Dec 2011, 3:15 AM
Same here:

http://www.sencha.com/forum/showthread.php?156957-PR1-Localstorage-Calling-Store.removeAll%28%29-doesn%C2%B4t-remove-anything. (info required)

greetings Sunny

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

diesalher
17 Jan 2012, 5:00 AM
Thanks!