I need to add a lots of records into an extjs data store dynamically by looping. But store.add takes normally much time. Is it possible to add these data togetherly?
You can use store.loadData() or store.loadRecords() methods:
var mydata = [
[1, 'John', 'Smith'],
[2, 'Fred', 'Jones']
];
store.loadData(mydata, false);
When adding or modifying big amount of data in ExtJS Store, I suggest you to disable all events by using method:
store.suspendEvents();
for(var i=0; i<9000, i++) {
store.add({ ... });
}
store.resumeEvents();
And when your inserting finishes, enable events again. This can very much improve your performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With