-
14 Oct 2009 7:04 AM #1
[FIXED][3.1] Remote groupby strange behaviour
[FIXED][3.1] Remote groupby strange behaviour
Hi - I've noticed a strange behaviour with my Grid when remote grouping (using groupingstore).
When one selects a column to group by, the "groupBy" parameter is correctly being passed to the server, so it's able to return the results sorted so that they can correctly be grouped.
If one then un-groups (clearing the "show in groups" checkbox), then groups by another field, this again works fine, sending the new "groupBy" to the server.
However, if one doesn't first un-group, but instead just chooses another column to group by, the "groupBy" sent to the server is still the first column, however, the the results are grouped by the new column (which then creates duplicate groups since the server's results are now incorrectly ordered).
I think this is a bug... when remote grouping, lastOptions.params.groupBy is not cleared when grouping is changed.
I've modified applyGroupField:
Any thoughts?Code:applyGroupField: function() { if (this.remoteGroup) { if (!this.baseParams) { this.baseParams = {}; } this.baseParams.groupBy = this.groupField; this.baseParams.groupDir = this.groupDir; if (this.lastOptions && this.lastOptions.params) { delete this.lastOptions.params.groupBy; } } }
-
15 Oct 2009 4:36 AM #2
I don't think you can do remote grouping. How would that work?
If you are paging from the server, you cannot be sure if the current page includes all of a group, or cuts it off part way through.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
15 Oct 2009 5:03 AM #3
Well, I need the groupBy to be sent to the server (together with the sortBy), so that I can sort by the groupBy (and within this, the sortBy), so that the grid is able to correctly group and sort.
The bug I've mentioned means that, under the circumstances I've mentioned, that the groupBy column is not correctly being sent to the server.
-
15 Oct 2009 5:28 AM #4
-
15 Oct 2009 7:22 AM #5
So why involve the server at all?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
15 Oct 2009 10:51 PM #6
I can't reproduce this with the SVN version.
1) Go to h1, click the header, group by this field.
2) The post goes out, 'field1, asc'.
3) Go to h2, click the header, group by this field.
4) The post goes out, 'field2, 'asc'.
Data:Code:Ext.onReady(function(){ var store = new Ext.data.GroupingStore({ remoteGroup: true, autoLoad: true, reader: new Ext.data.JsonReader({ root: 'data' }, ['field1', 'field2']), proxy: new Ext.data.HttpProxy({ url: 'data.asp' }) }); var g = new Ext.grid.GridPanel({ store: store, columns: [{ dataIndex: 'field1', header: 'h1' },{ dataIndex: 'field2', header: 'h2' }], view: new Ext.grid.GroupingView(), width: 600, height: 600, renderTo: document.body }); });
Code:{ data: [{ field1: 1, field2: 2 },{ field1: 3, field2: 4 },{ field1: 5, field2: 6 },{ field1: 7, field2: 8 },{ field1: 9, field2: 10 },{ field1: 11, field2: 12 }] }Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
16 Oct 2009 12:54 AM #7
-
16 Oct 2009 5:34 AM #8
Sounds like. Don't think it is.
The difference between the version here that works and my version is that in my code, lastOptions.params is set (and contains the paging direction, limit, sort and start parameters). This params object is then applied to the options that is sent through to execute, and the lastOptions.params then gains the groupBy here:
It then takes precedence in subsequent groups.Code:if (action === 'read') { Ext.applyIf(options.params, this.baseParams); doRequest = this.fireEvent('beforeload', this, options); }
-
19 Nov 2009 8:57 AM #9
I notice this has not been registered as a bug - it's still in 3.03 (and i needed to reapply my suggested code to make grouping work properly in my grid).
Any plans to fix this?
-
19 Nov 2009 7:39 PM #10
Can you post a test case? I know you posted a description above however I wasn't able to reproduce it.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote
