ExtJS change a grid's store on the fly

You can change an ExtJS grid on the fly after it has loaded by using reconfigure method on the grid.

This feature allows you to change the data store and adjust the columns.

The problem I ran into was how to populate a grid with data from associated model. In the example below, instance contains associations that are returned with the getSubObjects method:

// get the new store and a ref to the grid
var newStore = instance.getSubObjects(),  
    grid = this.getGridRef();

// reconfigures the grid with the new store
grid.reconfigure(newStore);  
comments powered by Disqus