1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    74
    Vote Rating
    0
    Answers
    5
    alex9311 is on a distinguished road

      0  

    Default Answered: Adding Ext.grid.feature.Grouping to grid breaks expand/collapse

    Answered: Adding Ext.grid.feature.Grouping to grid breaks expand/collapse


    Hey all,

    I'm messing with the grid grouping features so I can change the groupHeaderTpls for my groups. I got the headers to look how I want but now the expanding/collapsing isn't working. Is there a workaroud for this?

    Here is my Grid.js code, the commented features line is from my old version, this does allow expanding/collapsing.
    Code:
    Ext.define('BZ.view.blaze.Grid', {
            extend: 'Ext.grid.Panel',
            alias: 'widget.blazegrid',
            store: 'Blaze',
            autoScroll: 'true',
            //features:[{groupingFeature}],
            features: [Ext.create('Ext.grid.feature.Grouping', {
                            groupHeaderTpl: '{name} ({rows.length})',
                            collapsible: true,
                    })
            ],
            initComponent: function(){
                    var dateRender = Ext.util.Format.dateRenderer('m/d/Y');
                    this.columns=[
                            {header: 'Subject',     dataIndex: 'subject',   width:175},
                            {header: 'Sender',      dataIndex: 'sender',    width:75},
                            {header: 'Attachment',  dataIndex: 'attachment',        width:40,
                                    renderer: function(value){
                                            if(value=='')
                                                    return '';
                                            else
                                                    return '<img src="ext/resources/themes/images/default/grid/accept.png" />';
                                    }
                            }
                    ];
                    this.callParent(arguments);
            }
    });
    I declare a groupField in my store file
    Code:
    Ext.define('BZ.store.Blaze', {
            extend: 'Ext.data.Store',
            model: 'BZ.model.Blaze',
            data: [
                     //hardcoded data
            ],
            groupField: 'course',
            sortOnLoad: true,
            sorters: [{
                    property: 'date',
                    direction: 'DESC'
            }]
    });

  2. You should not do this:

    Code:
            features: [Ext.create('Ext.grid.feature.Grouping', {
                            groupHeaderTpl: '{name} ({rows.length})',
                            collapsible: true,
                    })
            ],
    Should really be like:

    Code:
            features: [
                    {
                            ftype : 'grouping',
                            groupHeaderTpl: '{name} ({rows.length})',
                            collapsible: true,
                    }
            ],

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    Answers
    3101
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      1  

    Default


    You should not do this:

    Code:
            features: [Ext.create('Ext.grid.feature.Grouping', {
                            groupHeaderTpl: '{name} ({rows.length})',
                            collapsible: true,
                    })
            ],
    Should really be like:

    Code:
            features: [
                    {
                            ftype : 'grouping',
                            groupHeaderTpl: '{name} ({rows.length})',
                            collapsible: true,
                    }
            ],
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    74
    Vote Rating
    0
    Answers
    5
    alex9311 is on a distinguished road

      0  

    Default


    This works perfectly, thank you!