View Full Version : LocalStorage non-integer id

30 Jan 2012, 8:03 AM
I am using the localstorage proxy for an offline app, but my data model uses a 32 char hexadecimal string for id, is there a reason that the id in local storage have to be integers? On line 34845 in the sencha-touch-all-debug-w-comments.js, the getIds function explicitly converts the ids to ints

ids[i] = parseInt(ids[i], 10);

This results in the key storing several NaN, some keys work correctly and others are integers.

In the code comments it states: @return {Number[]} The record IDs. Each is cast as a Number, but I don't really understand why, nor can I find any documentation regarding this.

30 Jan 2012, 9:18 AM
This is the sam behavior as in ST1. I will open a story to see what the core dev who handles the data package thinks or maybe there is an issue with using non-int values.

30 Jan 2012, 9:29 AM
id: integer or string?

merrells thinks string would be better (Sencha.io):


30 Jan 2012, 9:39 AM
ST1 through ST2 PR4 forces the id to int when a record is fetched.
The SIO SDK monkey patches this so that the id is not coerced to int.

This next release of ST2 includes a fix for this. Id's are now treated as auto.


2 Feb 2012, 8:25 AM
This code is still there in B1 for local storage id fields are still forced to be integers regardless of the model.

The code I am referencing is in data/proxy/WebStorage.js on line 321

2 Feb 2012, 8:30 AM
This code was added to pr4 and doesn't exist in pr3, is there a reason why?

2 Feb 2012, 7:09 PM
I filed a bug for this. It's planned to be fixed in the next release of ST2.


9 Feb 2012, 7:39 AM
Still an issue in ST2 B2

9 Feb 2012, 8:50 AM
The bug tracking system says it'll be fixed in B3.


14 Feb 2012, 1:53 PM
Still not fixed in B3

14 Feb 2012, 2:15 PM
This bug has not been closed yet and is not marked as fixed in our internal system. The problem is that it is not as easy as removing the parseInt call inside of WebStorage.js. There is a bit more involved. Ed and I have discussed a lot about how to go about this issue, and think we came up with a reasonable solution which we hope to have in place for the RC. I'm sorry if this issue inconveniences some of you in the meantime.

14 Feb 2012, 2:18 PM
Thanks, Tommy, I can work around it in the mean time and I am not planning on releasing my app until the ST2 is out of beta, so I don't mind. I just wanted to make sure that it is something that will get fixed, or I have to completely rework my app. Thanks again for the update.

15 Feb 2012, 5:56 AM

The bug tracking system says that it'll be fixed in GA.
(Yes, it keeps moving... Sorry.)


6 Mar 2012, 6:46 AM
Well the final release has now come and this is still not addressed. I now have to come up with a hack solution or rewrite my app.

7 Mar 2012, 6:21 AM
Hi mslosarek,

Sorry about not informing you guys on this thread. I explained the situation in the following thread: http://www.sencha.com/forum/showthread.php?185132-LocalStorage-proxy-using-id-that-is-not-an-integer-(32-digit-hex)

Like I said there, I will provide an override to fix this shortly.