问题
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