Question

I want to implement a dynamic column in grid panel, how can I do it? I used Extjs 4.0.7:

var result = Ext.JSON.decode(response.responseText);
store.model.setFields(result.fields);
grid.reconfigure(store, result.columns);
store.loadRawData(result.data, false);

The method setFields() doesn't exist in version 4.0.7

Was it helpful?

Solution

Try something like :

var store = new Ext.data.Store({fields: result.fields, data: result.data})

grid.reconfigure(store, result.columns})

The fields config on Store has always behaved this way, with the ability to pass in fields instead of a model. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.AbstractStore-cfg-fields

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top