VAAA
VAAA

Reputation: 15039

ExtJS 4.2 building grid columns and rows dynamically (the interface slows down)

I have a gridpanel that I build dynamically from server.

The result is the following image:

enter image description here

The code that I'm using after I get the data from the server is:

success: function(response, opts) { var obj = Ext.decode(response.responseText); if (obj.success) {

    gridStore.model.setFields(obj.data.metaData.fields);

    grid.reconfigure(gridStore, obj.data.metaData.columns);

    gridStore.loadRawData(obj.data.storeData, false);

}

},

Upvotes: 1

Views: 649

Answers (1)

newmount
newmount

Reputation: 1951

Try suspendLayouts and suspendEvents before re-configuring the grid and turn it on later

success: function(response, opts) {
    var obj = Ext.decode(response.responseText); 
    if (obj.success) {
        Ext.suspendLayouts();//Suspending layout should fast things up
        gridStore.suspendEvents(); //If needed suspend the events too

        gridStore.model.setFields(obj.data.metaData.fields);
        grid.reconfigure(gridStore, obj.data.metaData.columns);
        gridStore.loadRawData(obj.data.storeData, false);

        Ext.resumeLayouts(true);
        gridStore.resumeEvents();
    }
}

Upvotes: 1

Related Questions