View Full Version : [OPEN-1189] remote grouping grids refresh twice on group by click

9 Aug 2010, 11:33 AM
This probably isn't very noticeable until you have different values returned from the server for a field depending on whether or not it's grouped.

For example, and in my case, if my grid is not grouped by the project field, the value for the project field may be '3 Projects', but if it is grouped by the project field, the server returns 3 records instead of one, each with it's own project value (the name of the project). The objective is to show the same record 3 times in the grid, once in each of the 3 different groups.

The grid refreshes before the server returns the data, causing it to group on the value '3 Projects', which is not correct. Once the server data is returned it refreshes again with the correct group field values.

I'm not sure of the BEST way to fix this, but here is what I did...

view = new Ext.grid.GroupingView({
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Documents" : "Document"]})',
hideGroupedColumn: true,

//Fix for remote grouping causing view to refresh twice
onGroupByClick : function(){
this.enableGrouping = true;
this.grid.fireEvent('groupchange', this, this.grid.store.getGroupState());
this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups
if (!this.grid.store.remoteGroup) this.refresh(); //Don't refresh now, store load event will cause refresh

Jamie Avins
10 Aug 2010, 7:55 AM
Thanks for the report.