sencha touch同步存储性能问题 [英] sencha touch Sync store Performance issue

查看:151
本文介绍了sencha touch同步存储性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sencha touch 2.开发应用程序。
我有一个问题,使用store.sync()它花了太多(约20分钟)时间执行此语句。
我必须在商店中插入8500条记录。
有任何替代方法,以便下载更快。

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);
  });


推荐答案

您首先在sencha store加载所有8500条记录同步存储。立即在您的本地数据库备用表中保存数据,而不是加载商店中的所有数据,这将提高您的应用效果。

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.

代码需要更改

    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();

这篇关于sencha touch同步存储性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆