View Full Version : Syncing external JSON source to local storage

23 Jan 2012, 2:21 AM
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,


Sameer Khan
23 Jan 2012, 3:16 AM
1. new Ext.data.Store({
model: 'Dataset',
type: 'scripttag',
url: 'http:www.xxx.com/url?userId='+currUsr (http://www.xxx.com/url?userId='+currUsr),
reader: {type: 'json'},
listeners: {
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,
load: this.onDatasetSaved,
2. onDatasetSaved : function(clientstore, records, success){
var lrec=null;
var lstore = Ext.StoreMgr.lookup('dataset');
if( lstore.isLoading()==true){
alertMsg.alert("", "Assessments still loading.." ,function(){main.enable()}).doComponentLayout();