Results 1 to 2 of 2

Thread: [OPEN-1306] GroupingStore in a stateful GridPanel issue (store autoLoad not working)

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1

    Default [OPEN-1306] GroupingStore in a stateful GridPanel issue (store autoLoad not working)

    Hello,

    Context:
    1) stateful GridPanel that uses groupingstore with autoLoad set to false and remoteGrouping set to true
    2) the state manager contains state for this grid that contains columns info (but does not contain any store info)

    Issue:
    The groupingstore will load automatically (despite its autoLoad set to false)

    Debug:
    1) When it comes to initState function (Ext.Component) for the GridPanel it firest this.applyState(...)
    2) applyState function checks if this.store exists (it does exist) and if the store is a groupingstore (store.groupBy is an object)
    3) Since there is no state for the store (state.group is undefined), applyState executes store.clearGrouping which in turns reloads the store

    Questions:
    1) Should applyState function execute store.clearGrouping?
    2) Should GroupingStore.clearGrouping issue reload?

    Let me know if any further clarification is required.

    Thank you in advance for any help!

    Gregory

  2. #2
    Sencha Premium User d.zucconi's Avatar
    Join Date
    Jun 2008
    Location
    Piacenza (Italy)
    Posts
    102

    Default

    Any news for this bug ?
    This is my fix:
    Code:
    Ext.override(Ext.data.GroupingStore,{
        clearGrouping : function()
        {
           this.groupField = false;
    
    
          if(this.remoteGroup){
                 if(this.baseParams){
                    delete this.baseParams.groupBy;
                    delete this.baseParams.groupDir;
                }
                
                var lo = this.lastOptions;
                if(lo)
                {
                    if(lo.params){
                        delete lo.params.groupBy;
                        delete lo.params.groupDir;
                    }
                      this.reload();
                }
            }else{
                this.sort();
                this.fireEvent('datachanged', this);
            }
        },
        
        groupBy : function(field, forceRegroup, direction) 
        {
            direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;
    
    
            if (this.groupField == field && this.groupDir == direction && !forceRegroup) {
                return; // already grouped by this field
            }
    
    
            //check the contents of the first sorter. If the field matches the CURRENT groupField (before it is set to the new one),
            //remove the sorter as it is actually the grouper. The new grouper is added back in by this.sort
            var sorters = this.multiSortInfo.sorters;
            if (sorters.length > 0 && sorters[0].field == this.groupField) {
                sorters.shift();
            }
    
    
            this.groupField = field;
            this.groupDir = direction;
            this.applyGroupField();
    
    
            var fireGroupEvent = function() {
                this.fireEvent('groupchange', this, this.getGroupState());
            };
    
    
            if (this.groupOnSort) {
                this.sort(field, direction);
                fireGroupEvent.call(this);
                return;
            }
    
    
            if (this.remoteGroup) 
            {
                    if(this.lastOptions)
                    {
                    this.on('load', fireGroupEvent, this, {single: true});
                    this.reload();
                    }
            } else {
                this.sort(sorters);
                fireGroupEvent.call(this);
            }
        }
    });

Similar Threads

  1. [STALE-383] Store in 0.96 not working properly
    By axxerion in forum Sencha Touch 1.x: Bugs
    Replies: 12
    Last Post: 5 Nov 2010, 12:07 AM
  2. GridPanel, GroupingStore and store.filter
    By thatcoder in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 21 Oct 2009, 12:18 AM
  3. GridPanel with BufferView and stateful
    By droesler in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 29 Jul 2009, 7:07 PM
  4. GroupingStore and PagingToolbar in GridPanel not working
    By accilies in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Jan 2009, 7:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •