Results 1 to 9 of 9

Thread: Error when using grouping feature without active grouper

    This duplicates another bug already reported in our system: EXTJS-9979
  1. #1
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    201
    Vote Rating
    17
      0  

    Default Error when using grouping feature without active grouper

    Ext version tested:
    • Ext 4.2.1


    Browser versions tested against:
    • Chrome


    Description:
    When a grid has a grouping feature but no groupers in store. An error will occur in function getRowStyleTableEl in Ext.view.Table.

    Uncaught TypeError: Cannot call method 'addCls' of null


    Test Case:

    Use the grouping feature example in documentation and just comment out the groupField
    Or just follow this link to see the test and result

    Code:
        var store = Ext.create('Ext.data.Store', {
        storeId:'employeeStore',
        fields:['name', 'seniority', 'department'],
        //groupField: 'department',
        data: {'employees':[
            { "name": "Michael Scott",  "seniority": 7, "department": "Management" },
            { "name": "Dwight Schrute", "seniority": 2, "department": "Sales" },
            { "name": "Jim Halpert",    "seniority": 3, "department": "Sales" },
            { "name": "Kevin Malone",   "seniority": 4, "department": "Accounting" },
            { "name": "Angela Martin",  "seniority": 5, "department": "Accounting" }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'employees'
            }
        }
    });
    
    Ext.create('Ext.grid.Panel', {
        title: 'Employees',
        store: Ext.data.StoreManager.lookup('employeeStore'),
        columns: [
            { text: 'Name',     dataIndex: 'name' },
            { text: 'Seniority', dataIndex: 'seniority' }
        ],
        features: [{ftype:'grouping'}],
        width: 200,
        height: 275,
        renderTo: Ext.getBody()
    });

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    4
    Vote Rating
    0
      0  

    Default

    Is there a workaround for this?

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    4
    Vote Rating
    0
      0  

    Default

    ...yes, it is.
    Since in init-method is a view.isGrouping = true; without asking whether there is initially used a groupfield in store it has to be overwritten and set to false.

    PHP Code:
    Ext.override(groupingFeature, {              
      
    init: function(grid){                
        var 
    me this,                    
        
    view me.view;                
        
        
    this.callParent(arguments); //no "use strict" in your code please :-(

        
    view.isGrouping false// for the case that there is no groupfield in store...              
      
    }            
    }); 

  4. #4
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    201
    Vote Rating
    17
      0  

    Default Fiesta test available for this bug


  5. #5
    Sencha User
    Join Date
    May 2013
    Posts
    4
    Vote Rating
    1
      0  

    Default

    This is not a correct fix. If you enable isGrouping on init method, then if store has a groping isGrouping won't get set to true. Real problem is setup() method does not use the view's scope while setting isGrouping.

    Better approach is to fix setup() method, or override for workaround:
    PHP Code:
    Ext.override(groupingFeature, {                        
        
    setup: function(rowsrowValues){                           
            var 
    me this,                                
            
    view me.view;                          
            
    this.callParent(arguments); //no "use strict" in your code please :-(
            
    view.isGrouping = !me.disabled && me.view.store.isGrouped(); // for the case that there is no groupfield in store...                        
        
    }                    
    }); 

  6. #6
    Sencha User
    Join Date
    May 2013
    Posts
    4
    Vote Rating
    1
      1  

  7. #7
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    St. Louis
    Posts
    224
    Vote Rating
    10
      0  

    Default

    It is too bad 4.2.1 still has many critical bugs in it.

    For the grid grouping feature, the worst is when startCollapsed: true even though no grouper is active, the grid will not show anything.

    How come no field group is set will be trying group by nothing with startCollapsed?



    PHP Code:
               startCollapsedtrue 

  8. #8
    Sencha User
    Join Date
    Mar 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    thanks bariscicek for the fix! this works for me

  9. #9
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    26
    Vote Rating
    1
      0  

    Default

    any updates on this bug???

Posting Permissions

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