lylepratt
20 Nov 2011, 3:48 PM
REQUIRED INFORMATION
Ext version tested:
Sencha Touch 2 rev PR2
Browser versions tested against:
Safari
Mobile Safari
Android Browser
Chrome
DOCTYPE tested against:
HTML5 Doctype
Description:
If you update an item in a localstorage proxy, a new ID is added to the IDs set when it is not supposed to.
This seems to happen because the code to add an ID is checking to see if the ID exists before adding it. But, the IDs in the localstorage returned by the 'getIds' function are STRINGS, whereas the ids normally provided to a local storage a INTs.
Steps to reproduce the problem:
Create a storage with a localstorage proxy.
Set a model on a store that has an ID with the type "int".
Update an item in the local store and watch the ID you just added get duplicated.
The result that was expected:
The update should not have created a new ID. It should have found the existing one.
The result that occurs instead:
A new ID is added to the local store.
HELPFUL INFORMATION
It seems to only happen if your ID in the Model is a type="int".
Possible fix:
On Line 32174 of sencha-touch-all-debug-w-comments.js in PR2 change the IF statement to the following:
if (id !== undefined && Ext.Array.indexOf(ids, String(id)) == -1) {
I am just making sure that the ID provided is a string like it will be in the array of IDS provided by 'getIds()'
Ext version tested:
Sencha Touch 2 rev PR2
Browser versions tested against:
Safari
Mobile Safari
Android Browser
Chrome
DOCTYPE tested against:
HTML5 Doctype
Description:
If you update an item in a localstorage proxy, a new ID is added to the IDs set when it is not supposed to.
This seems to happen because the code to add an ID is checking to see if the ID exists before adding it. But, the IDs in the localstorage returned by the 'getIds' function are STRINGS, whereas the ids normally provided to a local storage a INTs.
Steps to reproduce the problem:
Create a storage with a localstorage proxy.
Set a model on a store that has an ID with the type "int".
Update an item in the local store and watch the ID you just added get duplicated.
The result that was expected:
The update should not have created a new ID. It should have found the existing one.
The result that occurs instead:
A new ID is added to the local store.
HELPFUL INFORMATION
It seems to only happen if your ID in the Model is a type="int".
Possible fix:
On Line 32174 of sencha-touch-all-debug-w-comments.js in PR2 change the IF statement to the following:
if (id !== undefined && Ext.Array.indexOf(ids, String(id)) == -1) {
I am just making sure that the ID provided is a string like it will be in the array of IDS provided by 'getIds()'