View Full Version : Reconfigure GridPanel with GroupingStore/GroupingView

3 Mar 2011, 2:23 AM
Hello, I have a delicate problem with a GridPanel that uses a GroupingView:

var grid1 = new Ext.grid.GridPanel({
store: new Ext.data.GroupingStore({
fields: [ ]
cm: new Ext.grid.ColumnModel([ ]),
selModel: new Ext.grid.RowSelectionModel({ singleSelect: false }),
view: new Ext.grid.GroupingView({
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "' + BPS.Resource.items + '" : "' + BPS.Resource.item + '"]})'

I an event I call reconfigure that sets a new store and columnmodel. The store is a GroupingStore and I set what groupField i want to use:

// define the store
var store1 = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({
url: listConfig.dataURL + '?sort=' + listConfig.defaultSortField + '&dir=' + listConfig.defaultSortDirection,
method: 'POST'
autoLoad: false,
remoteSort: true,
remoteGroup: true,
groupOnSort: false,
groupField: listConfig.groupingColumn,
sortInfo: {
field: listConfig.defaultSortField,
direction: listConfig.defaultSortDirection
paramNames: {
start: 'skip',
limit: 'take',
sort: 'sort',
dir: 'dir'
reader: new Ext.data.JsonReader()

// reconfigure the grid
grid1.reconfigure(store1, new Ext.grid.ColumnModel(listConfig.columnDefinitions));

However, this seem to work the first time it's loaded but after the user turn off that the gridpanel should be grouped and call it again it doesn't reset to be grouped.

What can I do to reconfigure the grid to use, or not use, grouping?