PDA

View Full Version : Store performance



sf_cs
2 Aug 2013, 2:00 AM
Hi,

we have a list which is connected to a store. We filled the store with data from a phonegap database like that:



var store = Ext.getStore('Storename');

for (var i=0; i<data.length; i++){
var modelObject = new Object();
modelObject.var1= data.asdf;
modelObject.var2= data.qwer;
store.add(modelObject);
}


With the above code we experienced very bad performance. We found out that each add rebuild the list. We got a much better performance with the following code



var store = Ext.getStore('Storename'),
modelArray = new Array(),

for (var i=0; i<data.length; i++){
var modelObject = new Object();
modelObject.var1= data.asdf;
modelObject.var2= data.qwer;
modelArray.push(modelObject);
}
store.add(modelArray);


Regards

fmoseley
5 Aug 2013, 12:45 PM
Thank you for sharing.