TODO: Flush out with details and examples. Any takers to help?
Anytime you receive data from your server that the store did not specifically ask you to retrieve or update, you need to push it in to the store. Pushing differs from retrieving data in that a record could be in any state when you try to push it; not just BUSY.
To push data into the store, use one of pushRetrieve(), pushError(), or pushDestroy(). Pass storeKeys. pushRetrieve also has you include data hashes.
If you try to push data to a storeKey that can't take your data. (let's say its been modified in memory and pushing data would override the changes), the method will return NO indicating an error. You should choose how to resolve it.
Calling loadRecords() to load data can be used instead of pushRetrieve() OR dataSourceDidComplete(). loadRecords() inspects the status of each record and calls the proper method.
Moving On
You done with the core programming guide!
Back to DataStore Programming Guide Home ยป
Comments (2)
Maurits Lamers said
at 5:56 am on Jul 23, 2010
I am trying to implement pushing, but it is unclear where to get a reference to the store to be able to call these methods. Should I use SC.Store instead?
Sud said
at 8:25 am on Jul 23, 2010
SC.Store is a prototype, not an object. Try YourAppNameHere.store
You don't have permission to comment on this page.