
Originally Posted by
mrsunshine
you can check the count of the store and work with a record with the same ID, should be only one record in the store. so if no record exist create one otherwise work with the existing one
I'm doing this, but notice that if I check the Resources tab in Chrome's Developer Tools under LocalStorage -> localhost, I can see that there are entries for both 'myUniqueProxy' and 'myUniqueProxy-0' (I set the id to the model to be 0).
There are never any more entries in 'myUniqueProxy-0' other than the one I want, however it looks like there are tons entries for '0' in 'myUniquProxy'. Apparently one for every save despite it being the same record.
Here's an image of what I'm seeing (don't pay attention to any malformed data, I modified it for this post):
screenshot.png
My proxy is setup like this:
Code:
proxy : {
type : 'localstorage',
id : 'myUniqueProxy',
}
My Model has an id field like this:
Code:
{
name : 'id',
type : 'integer',
defaultValue : 0,
isUnique : true
}
Then just like you said, I call for the store to getRecordById(0), update that record with current data and save it.
Am I doing something wrong to get so many entries in the 'myUniqueProxy' entry?
Thanks in advance for any advice.
bwags