View Full Version : Localstorage help

29 Nov 2010, 2:39 PM
I am attempting to create an app that runs offline and syncs with our back-end database when the app goes back online. I have a store that has 500 records pre-loaded. I use this code to pull records from localStorage:

Ext.regModel('ministries', {
idProperty: 'MINISTRYID',
fields: arr

var ministryDS = new Ext.data.Store({
model: 'ministries',
proxy: new Ext.data.LocalStorageProxy({
id: 'ministries'

scope: this,
callback: function(records) {

This loads all of the records successfully, but they are all marked as dirty. This becomes an issue when trying to sync with the server.

Flow example:

1. User hits app, store is filled with data
2. User is out of range and the app runs offline.
3. User makes some changes to the data.
4. User closes the app completely.
5. Later on, the user hits the app and is within service. The app pulls all of the records from localStorage but has no idea which records are 'dirty' because every record is considered dirty at that point.

I hope this makes sense. Is there a way to have the 'dirty' flag pass all the way to localStorage, or is this something we'll have to build ourselves?