1. #1
    Sencha User alok.sharma127's Avatar
    Join Date
    Jun 2012
    Posts
    14
    Answers
    1
    Vote Rating
    1
    alok.sharma127 is on a distinguished road

      0  

    Default Answered: Problems with store syncing

    Answered: Problems with store syncing


    What I'm trying to do:


    To let the user be able to store data locally until he decides to upload it all. To achieve this, I am filling the data from a form into a model and then filling a store (sync) with this model. This store has a local storage proxy.
    offlineStore.js:

    Code:
    Ext.define('blahblah.store.offlineStore',{
    extend:'Ext.data.Store',
    config:{
        model:'blahblah.model.myModel',
        id: 'offlineRegisterStore',
        sorters:'xyz',
        grouper:function(record){
            return record.get('xyz')[0];
        },
        proxy: {
            type: 'localstorage',
            id: 'offlineRegisterStoreid'
        }
     ...
    Now, when the user presses the sync button, I copy data from this offline store, to another store having a proxy that does the REST call:
    OnlineStore:



    Code:
    Ext.define('blahblah.store.upStore', {
         extend: 'Ext.data.Store',
         config: {
            model: 'blahblah.model.myModel',
            id: 'abc',
            sorters: 'xyz',
            grouper: function (record) {
              return record.get('xyz')[0];
            },
            proxy: {
            type: 'rest',
            url: HOST,
            headers: HEADERS,
            reader: {
                type: 'json'
    
            },
            writer: {
                type: 'json'
            }
        ...
    The Problem:

    Unfortunately, my online store is not even executing store.sync() after I add data from the offline store into it. As a result of which, no REST call is made. I realize that this happens when the store has unchanged data being synced. This was odd since I had added nothing to the online store prior to copying data into it from the offline store.

    So I did a console.log on the online store right after I created it. I saw that this store already has the form data filled in it. And, I'm guessing this is why sync() is not executed, since I'm adding this same data back into it, just this time, from the offline store. I'm puzzled about how and from where did this online store get its data.
    I also tried store.removeAll() before I added anything from the offline store into the online storebut it had no effect on the store content.

    Do tell if you need to see more code.

  2. Found a solution to this thanks to @Farish. You can view the full thread at http://www.sencha.com/forum/showthread.php?154390-Store-not-syncing-properly

    Basically I used record.phantom = true before I added them to the problematic store. Using this, the store did execute sync().

  3. #2
    Sencha User alok.sharma127's Avatar
    Join Date
    Jun 2012
    Posts
    14
    Answers
    1
    Vote Rating
    1
    alok.sharma127 is on a distinguished road

      0  

    Default


    Found a solution to this thanks to @Farish. You can view the full thread at http://www.sencha.com/forum/showthread.php?154390-Store-not-syncing-properly

    Basically I used record.phantom = true before I added them to the problematic store. Using this, the store did execute sync().

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