Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding dynamic data to extjs store

Tags:

store

extjs

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?

like image 493
Sarika.S Avatar asked Apr 23 '13 09:04

Sarika.S


2 Answers

You can use store.loadData() or store.loadRecords() methods:

 var mydata = [
     [1, 'John', 'Smith'],
     [2, 'Fred', 'Jones']
 ];
store.loadData(mydata, false); 
like image 181
Vlad Avatar answered Sep 25 '22 01:09

Vlad


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.

like image 41
stinger Avatar answered Sep 23 '22 01:09

stinger