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

      0  

    Question Syncing external JSON source to local storage

    Syncing external JSON source to local storage


    Hi guys,

    I'm developing an application for representatives of our company. They'll use it when they visit customers and write orders for them.

    Currently a single representative has a minimum of 250 customers, all of which need to be synced to the local device because not all customers are within reach of an internet connection whether it's Wifi or 3G.

    Besides the customers there are also the products that needs to be synced. Currently our catalog of around 1800 different SKU's is divided in 9 groups, which in turn are divided in products. These products have different models which can have different colors. Do you still follow me?

    Well to clarify. A group has several products. A product has several models and models have several colors.

    As soon as the app is started for the first time I check if the local storage is filled with products and customers. If it is, I don't need to sync, though this can be manually triggered. If it isn't I trigger the sync. The sync is a different store connected to an external JSON source using Basic auth. I then grab the records and put it in a MixedCollection to be handled by an DelayedTask due to the low time out treshold on the iPad.

    Though this works fine it takes a very long time before all products and customers are synced. Now I could just say to the representatives that they need to sync in the evenings when they're not using the iPad, but I rather just speeds things up. Do you guys have any suggestions?

    With kind regards,

    Edwin

  2. #2
    Sencha User Sameer Khan's Avatar
    Join Date
    Oct 2011
    Location
    Bangalore, India
    Posts
    113
    Vote Rating
    0
    Sameer Khan is on a distinguished road

      0  

    Default


    1. new Ext.data.Store({
    model: 'Dataset',
    proxy:{
    type: 'scripttag',
    url: 'http:www.xxx.com/url?userId='+currUsr,
    reader: {type: 'json'},
    listeners: {
    exception:{
    element: 'el',
    fn:function(proxy, response, operation){
    alertMsg.alert("","Server not responding for Assessemnts.<br/>Please try after sometime.", function(){myMask.hide();clinicianhome.doFilter();});
    }
    },
    }
    },
    autoLoad: true,
    listeners:{
    load: this.onDatasetSaved,
    scope:this
    }
    });
    2. onDatasetSaved : function(clientstore, records, success){
    var lrec=null;
    this.storeUpdated=false;
    var lstore = Ext.StoreMgr.lookup('dataset');
    lstore.clearFilter(true);
    if( lstore.isLoading()==true){
    myMask.hide();
    main.disable();
    alertMsg.alert("", "Assessments still loading.." ,function(){main.enable()}).doComponentLayout();
    return;
    }
    lstore.load();
    lstore.sync();


    },
    Sameer Khan

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar