PDA

View Full Version : Performance Issue while adding 200 or more records to GridPanel



ajay.kumar2
8 May 2013, 8:31 AM
I have a GridPanel which uses a Ext.data.JsonStore for storing objects. I am creating a record and adding to the Grid using below code in a for loop in my javascript code.

var myField = Ext.getCmp('mygridId').myGrid.store.fields;
var myRecord = Ext.data.Record.create(myField);
var newRecord = new scanRecord({ // setting some properties here });

//adding records to grid here
Ext.getCmp('mygridId').scanGrid.store.add(newRecord);

the above line which is adding record to the grid is taking 30 secs to add 200 items.

Is there a way that this can be refactored to improve performance ?


Any direction on this would be appreciable.

thanks,

rich02818
9 May 2013, 7:04 AM
Perhaps try storing the component reference so it does not have to be fetched each time:

var myGridStore = Ext.getCmp('mygridId').scanGrid.store;

then add records in your loop:

myGridStore.add(newRecord);