I am defining a grid which has a selModel
.
selModel
disappears.
How can I reconfigure the grids columns to also include the selModel.
Below is some example code:
//The Selection Model for the grid.
var sm = new Ext.selection.CheckboxModel();
//The Grid
var 开发者_如何学Gogrid = new Ext.grid.Panel({
store: store,
selModel: sm,
columns:[{
header: 'Loading ...'
}]
});
//The store on load event where the columns are reconfigured
store.on('load', function(store){
var columns = store.data.Data.items;
grid.reconfigure(store, columns);
}, this);
In ExtJs3 I could specify the selModel as a column itself but this is not the case in ExtJs4. So how can I ensure the selModel is always visible even after reconfiguring the grids columns?
It's a bug which is reported in Extjs version [4.0.2]. Now, it has resolved in Extjs version [4.0.7].
From the 3.3.1 API docs (my emphasis):
Reconfigures the grid to use a different Store and Column Model and fires the 'reconfigure' event. The View will be bound to the new objects and refreshed. Be aware that upon reconfiguring a GridPanel, certain existing settings may become invalidated. For example the configured autoExpandColumn may no longer exist in the new ColumnModel. Also, an existing PagingToolbar will still be bound to the old Store, and will need rebinding. Any plugins might also need reconfiguring with the new data.
I believe you just need to re-set the SelectionModel after you reconfigure your grid.
精彩评论