sencha touch Sync store Performance issue

谁都会走 提交于 2019-12-11 02:49:32

问题


I am developing application using sencha touch 2. I have one problem using store.sync() its taking too much (about 20 min) time while execution this statement. I have to insert 8500 records into store. Is there any alternative way so that downloading gets done faster.

 var spareStore = Ext.getStore('Spares');
  spareStore.removeAll();
  spareStore.add(spareList);
  spareStore.sync();
  spareStore.load();
  var spareData = []
  spareStore.each(function(rec){
    spareData.push(rec.data);
  });

回答1:


You are loading all 8500 records first in sencha store then sync store. Instant of directly save data in your local database spare table than load all data in store it will increase your app performance.

Code will you need to change

    var db = window.openDatabase("databasename", "1.0", "database", 10000000);
    db.transaction(queryDB, errorCB);
    function queryDB(tx) {
        for(indexcnt = 0; indexcnt < record.length; indexcnt++)
        {
           var id = indexcnt+1;
           tx.executeSql(insert query);   //put here your table insert query put here
        }
        spareStore.load();


来源:https://stackoverflow.com/questions/23995492/sencha-touch-sync-store-performance-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!