1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Vote Rating
    0
    onlineWerbung is on a distinguished road

      0  

    Default Unanswered: Localstorage overwrite existing Data

    Unanswered: Localstorage overwrite existing Data


    Hello,

    i try to use the local storage to save app-preferences, but every time i do, i get a new data record.

    How can i override an existing record?
    I tried to implement a field for "id" in my model and than passed a value of "1" (appPrefs_store.add({id:1, value: "value"})), but this doesn't work.

    Currently each data record in the local storage has a key named as the model (appPrefs_Model-1, appPrefs_Model-2...).
    Is it possible to choose the key myself e. g. "appPrefs", and than load/save the data by that key?

    Thank you

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    18
    Vote Rating
    0
    Whitejoker is on a distinguished road

      0  

    Default


    First, retrieve the record you'd like to update, then update the record with a new value:

    Code:
    var record = appPrefs_store.getById(1);
    record.set('value', "value");
    appPrefs_store.sync();

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Vote Rating
    0
    onlineWerbung is on a distinguished road

      0  

    Default


    Hello,


    thank you for your answer.

    An is it possible to use my own key or is it always the name of the model,
    and than key/value pairs as json-data as "value".


    Thanks

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    18
    Vote Rating
    0
    Whitejoker is on a distinguished road

      0  

    Default


    Well depends on what you want to do. Obviously you could put all data into one record expanding your model with new fields. Then you can specify what the info is, because the key in local storage will always be specified by Sencha.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    8
    Vote Rating
    0
    onlineWerbung is on a distinguished road

      0  

    Default


    Okay, that was what i wanted to know.

    Thanks a lot

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi