Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-3694 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Jan 2011
    Location
    London, UK
    Posts
    50
    Vote Rating
    2
    welshcathy is on a distinguished road

      0  

    Default [2.1.0] Dynamically setting List to Grouped fails

    [2.1.0] Dynamically setting List to Grouped fails


    I have a list which is initially rendered ungrouped on a store with no grouper function defined.

    I use the following code to dynamically change this to a grouped list
    Code:
            
            var store = list.getStore();
    
            store.setGrouper(<grouper function>);
            list.setGrouped(true);
    This used to work in Touch 2.0.1 but now there's an error in Ext.dataview.List as headerIndices are not defined during the all to list.setGrouped(true);
    They are only updated on list.refresh();

    Suggested patch to Ext.dataview.List
    Code:
        updateGrouped: function(grouped) {
            var me = this,
                baseCls = this.getBaseCls(),
                cls = baseCls + '-grouped',
                unCls = baseCls + '-ungrouped';
    
    
            if (grouped) {
                // START OF PATCH
                if (!me.headerIndices){
                   me.findGroupHeaderIndices();
                }
                // END OF PATCH
                me.addCls(cls);
                me.removeCls(unCls);
                me.updatePinHeaders(me.getPinHeaders());
            }
            ......
    Sorry don't have time to post an example right now .. hope you can work with this...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    714
    Vote Rating
    42
    ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about

      0  

    Default


    I just ran into this myself. BTW: the opposite (ungrouping) works:
    Code:
    list.setGrouped(false);

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    This problem has been fixed for the next release. In the meantime you can use the following override:

    Code:
    Ext.define('Ext.ListGroupFix', {
        override: 'Ext.dataview.List',
        
        updateGrouped: function(grouped) {
            var me = this,
                baseCls = this.getBaseCls(),
                cls = baseCls + '-grouped',
                unCls = baseCls + '-ungrouped';
    
            if (grouped) {
                me.addCls(cls);
                me.removeCls(unCls);
                me.updatePinHeaders(me.getPinHeaders());
            }
            else {
                me.addCls(unCls);
                me.removeCls(cls);
                me.updatePinHeaders(null);
            }
    
            me.doRefresh();
        }
    });
    Thanks for the report.