View Full Version : Grouping does not work after clearGrouping()

2 Jan 2010, 12:49 PM
In 3.1, grid grouping will not work if you start without a groupField or after calling clearGrouping(). This did work in 3.0. It is easy to recreate by adding the following to examples/grid/grouping.js

{ text:"company", handler: function(){ grid.getStore().groupBy('company'); } }
,{ text:"industry", handler: function(){ grid.getStore().groupBy('industry'); }}
,{ text:"none", handler: function(){ grid.getStore().clearGrouping(); }}

You can change between company and industry, but after clearGrouping() you will be unable to group by either field.

I think it has something to do with sorting, but I haven't been able to figure it out.

8 Jan 2010, 8:14 PM
In 3.0, you could conveniently enable and disable grouping by calling groupBy() and clearGrouping() on the grid store.

Now in 3.1, grouping does not work after you call clearGrouping(). Stepping through the code I see that enableGrouping is latched:

this.enableGrouping = (this.enableGrouping === false) ? false : !!groupField;

Internal to the GroupingView, "group by this field" header menu now explicitly sets enableGrouping:

// private
onGroupByClick : function(){
this.enableGrouping = true;
this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups

It doesn't feel right that I should have to poke at a config option like enableGrouping to re-enable grouping. Maybe this is common place, but I've always considered config options to only be valid in the constructor. I'm wondering if this is a bug or really intended functionality?