Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cambridge
    Posts
    97
    Vote Rating
    0
    markalroberts is on a distinguished road

      0  

    Question [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:

    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;
                }
            }
        }
    Any thoughts?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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.

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cambridge
    Posts
    97
    Vote Rating
    0
    markalroberts is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by Animal View Post
    ... If you are paging from the server ...
    The OP doesn't mention paging!

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    So why involve the server at all?

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,050
    Vote Rating
    658
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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'.

    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
        });
    });
    Data:
    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!

  7. #7
    Ext User
    Join Date
    Dec 2007
    Posts
    159
    Vote Rating
    2
    jburnhams is on a distinguished road

      0  

    Default


    Sounds like this fixed bug.

  8. #8
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cambridge
    Posts
    97
    Vote Rating
    0
    markalroberts is on a distinguished road

      0  

    Default


    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:

    Code:
            if (action === 'read') {
                Ext.applyIf(options.params, this.baseParams);
                doRequest = this.fireEvent('beforeload', this, options);
            }
    It then takes precedence in subsequent groups.

  9. #9
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cambridge
    Posts
    97
    Vote Rating
    0
    markalroberts is on a distinguished road

      0  

    Default


    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?

  10. #10
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,050
    Vote Rating
    658
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!