-
13 Dec 2011 8:26 PM #1
How to update existing record in localstorage store
How to update existing record in localstorage store
Hi,
I have problem with updating of existing record in localstorage store.
Adding a new records with:
store.add(newRecord);store.sync();- no problem.
But if I try update already created record:
var record = store.findRecord('id', createdId);record.set(updatedRecord); //updatedRecord is key-value object with new record- error:
Uncaught TypeError: Cannot call method 'update' of undefined (in PR3 ST2)
and
Uncaught TypeError: Cannot read property 'isModel' of undefined (in PR2 ST2)
Where it may be my mistake?
-
14 Dec 2011 6:28 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,666
- Vote Rating
- 435
local storage has been a little broken. This will get fixed before way before GA
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Dec 2011 7:11 AM #3
hmm.. it is a pity
perhaps there is a patch to fix the problem until the next release?
-
22 Dec 2011 2:46 PM #4
Is there any other way to locally store data at the moment? I'm really in need of this

-
22 Dec 2011 3:10 PM #5
You'd have to implement your own version of it, which wouldn't be too difficult.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
17 May 2012 5:46 AM #6
I see there is no activity in this thread since December. Any updates on this?
-
17 May 2012 7:20 AM #7
All works fine for now
-
17 May 2012 7:28 AM #8
Perhaps I didn't explain myself correctly. Is there a way to update the localStorage records? Something along the lines of:
record.update({fieldkey:fieldval, ...})?
I know you can use record.setData({...}), but what if you have a record with several fields, and you are interested in updating only a few of those fields?
Thank you in advance.
-
17 May 2012 7:47 AM #9
http://docs.sencha.com/touch/2-0/#!/...ore-method-add
Code:storeObj.add({field: 'value'}); storeObj.sync();// Or setup autoSync: true in store config
-
17 May 2012 7:55 AM #10


Reply With Quote