1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    26
    Answers
    1
    Vote Rating
    0
    Rhogar is on a distinguished road

      0  

    Exclamation Unanswered: Store & local storage not saving data!

    Unanswered: Store & local storage not saving data!


    Hi guys, hoping you can help me out here-
    I've got a problem with local storage where records added one at a time are saved throughout page refreshes in the local storage, but this only applies to adding new records.
    If I try to update a record, or remove at an index and insert a new record in the same spot with updated data, it isn't stored through the refresh in memory and the javascript crashes trying to load back in data that didn't persist. If I just update the record's data nothing persists and the right amount of records are there, but if I remove and insert, or just remove and add, all the other records are fine, but the new one isn't saved. Hope this makes sense!

    noteStore.insert(noteID - 1,{id: noteID, noteText:thisField.getValue(), bookmarkID: noteID});
    noteStore.sync();
    noteStore.save();

    doesn't cause issues but nothing is saved

    but putting:
    noteStore.removeAt(noteID - 1); //delete the old note
    noteStore.insert(noteID - 1,{id: noteID, noteText:thisField.getValue(), bookmarkID: noteID});

    doesn't persist through refreshing

    Thanks in advance guys!

  2. #2
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,395
    Answers
    148
    Vote Rating
    23
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi.
    I think you have some "dirty" data in your local storage.
    Try to make a test by simply trying to change your model local storage proxy id, just to have a clean start.
    However, did you take a look at the localstorage example in the official docs?

    http://docs.sencha.com/touch/1-1/#!/...alStorageProxy

    However, don't forget to perform a sync after removing data from the store.

    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX