Upgrade to ExtJS 3.2.0 - Released 03/30/2010
[extjs.git] / docs / source / GroupingView.html
index 3915285..0c31ed4 100644 (file)
-<html>\r
-<head>\r
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
-    <pre class="prettyprint lang-js"><div id="cls-Ext.grid.GroupingView"></div>/**\r
- * @class Ext.grid.GroupingView\r
- * @extends Ext.grid.GridView\r
- * Adds the ability for single level grouping to the grid. A {@link Ext.data.GroupingStore GroupingStore}\r
- * must be used to enable grouping.  Some grouping characteristics may also be configured at the\r
- * {@link Ext.grid.Column Column level}<div class="mdetail-params"><ul>\r
- * <li><code>{@link Ext.grid.Column#emptyGroupText emptyGroupText}</li>\r
- * <li><code>{@link Ext.grid.Column#groupable groupable}</li>\r
- * <li><code>{@link Ext.grid.Column#groupName groupName}</li>\r
- * <li><code>{@link Ext.grid.Column#groupRender groupRender}</li>\r
- * </ul></div>\r
- * <p>Sample usage:</p>\r
- * <pre><code>\r
-var grid = new Ext.grid.GridPanel({\r
-    // A groupingStore is required for a GroupingView\r
-    store: new {@link Ext.data.GroupingStore}({\r
-        autoDestroy: true,\r
-        reader: reader,\r
-        data: xg.dummyData,\r
-        sortInfo: {field: 'company', direction: 'ASC'},\r
-        {@link Ext.data.GroupingStore#groupOnSort groupOnSort}: true,\r
-        {@link Ext.data.GroupingStore#remoteGroup remoteGroup}: true,\r
-        {@link Ext.data.GroupingStore#groupField groupField}: 'industry'\r
-    }),\r
-    colModel: new {@link Ext.grid.ColumnModel}({\r
-        columns:[\r
-            {id:'company',header: 'Company', width: 60, dataIndex: 'company'},\r
-            // {@link Ext.grid.Column#groupable groupable}, {@link Ext.grid.Column#groupName groupName}, {@link Ext.grid.Column#groupRender groupRender} are also configurable at column level\r
-            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price', {@link Ext.grid.Column#groupable groupable}: false},\r
-            {header: 'Change', dataIndex: 'change', renderer: Ext.util.Format.usMoney},\r
-            {header: 'Industry', dataIndex: 'industry'},\r
-            {header: 'Last Updated', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}\r
-        ],\r
-        defaults: {\r
-            sortable: true,\r
-            menuDisabled: false,\r
-            width: 20\r
-        }\r
-    }),\r
-\r
-    view: new Ext.grid.GroupingView({\r
-        {@link Ext.grid.GridView#forceFit forceFit}: true,\r
-        // custom grouping text template to display the number of items per group\r
-        {@link #groupTextTpl}: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
-    }),\r
-\r
-    frame:true,\r
-    width: 700,\r
-    height: 450,\r
-    collapsible: true,\r
-    animCollapse: false,\r
-    title: 'Grouping Example',\r
-    iconCls: 'icon-grid',\r
-    renderTo: document.body\r
-});\r
- * </code></pre>\r
- * @constructor\r
- * @param {Object} config\r
- */\r
-Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {\r
-\r
-    <div id="cfg-Ext.grid.GroupingView-groupByText"></div>/**\r
-     * @cfg {String} groupByText Text displayed in the grid header menu for grouping by a column\r
-     * (defaults to 'Group By This Field').\r
-     */\r
-    groupByText : 'Group By This Field',\r
-    <div id="cfg-Ext.grid.GroupingView-showGroupsText"></div>/**\r
-     * @cfg {String} showGroupsText Text displayed in the grid header for enabling/disabling grouping\r
-     * (defaults to 'Show in Groups').\r
-     */\r
-    showGroupsText : 'Show in Groups',\r
-    <div id="cfg-Ext.grid.GroupingView-hideGroupedColumn"></div>/**\r
-     * @cfg {Boolean} hideGroupedColumn <tt>true</tt> to hide the column that is currently grouped (defaults to <tt>false</tt>)\r
-     */\r
-    hideGroupedColumn : false,\r
-    <div id="cfg-Ext.grid.GroupingView-showGroupName"></div>/**\r
-     * @cfg {Boolean} showGroupName If <tt>true</tt> will display a prefix plus a ': ' before the group field value\r
-     * in the group header line.  The prefix will consist of the <tt><b>{@link Ext.grid.Column#groupName groupName}</b></tt>\r
-     * (or the configured <tt><b>{@link Ext.grid.Column#header header}</b></tt> if not provided) configured in the\r
-     * {@link Ext.grid.Column} for each set of grouped rows (defaults to <tt>true</tt>).\r
-     */\r
-    showGroupName : true,\r
-    <div id="cfg-Ext.grid.GroupingView-startCollapsed"></div>/**\r
-     * @cfg {Boolean} startCollapsed <tt>true</tt> to start all groups collapsed (defaults to <tt>false</tt>)\r
-     */\r
-    startCollapsed : false,\r
-    <div id="cfg-Ext.grid.GroupingView-enableGrouping"></div>/**\r
-     * @cfg {Boolean} enableGrouping <tt>false</tt> to disable grouping functionality (defaults to <tt>true</tt>)\r
-     */\r
-    enableGrouping : true,\r
-    <div id="cfg-Ext.grid.GroupingView-enableGroupingMenu"></div>/**\r
-     * @cfg {Boolean} enableGroupingMenu <tt>true</tt> to enable the grouping control in the column menu (defaults to <tt>true</tt>)\r
-     */\r
-    enableGroupingMenu : true,\r
-    <div id="cfg-Ext.grid.GroupingView-enableNoGroups"></div>/**\r
-     * @cfg {Boolean} enableNoGroups <tt>true</tt> to allow the user to turn off grouping (defaults to <tt>true</tt>)\r
-     */\r
-    enableNoGroups : true,\r
-    <div id="cfg-Ext.grid.GroupingView-emptyGroupText"></div>/**\r
-     * @cfg {String} emptyGroupText The text to display when there is an empty group value (defaults to <tt>'(None)'</tt>).\r
-     * May also be specified per column, see {@link Ext.grid.Column}.{@link Ext.grid.Column#emptyGroupText emptyGroupText}.\r
-     */\r
-    emptyGroupText : '(None)',\r
-    <div id="cfg-Ext.grid.GroupingView-ignoreAdd"></div>/**\r
-     * @cfg {Boolean} ignoreAdd <tt>true</tt> to skip refreshing the view when new rows are added (defaults to <tt>false</tt>)\r
-     */\r
-    ignoreAdd : false,\r
-    <div id="cfg-Ext.grid.GroupingView-groupTextTpl"></div>/**\r
-     * @cfg {String} groupTextTpl The template used to render the group header (defaults to <tt>'{text}'</tt>).\r
-     * This is used to format an object which contains the following properties:\r
-     * <div class="mdetail-params"><ul>\r
-     * <li><b>group</b> : String<p class="sub-desc">The <i>rendered</i> value of the group field.\r
-     * By default this is the unchanged value of the group field. If a <tt><b>{@link Ext.grid.Column#groupRenderer groupRenderer}</b></tt>\r
-     * is specified, it is the result of a call to that function.</p></li>\r
-     * <li><b>gvalue</b> : Object<p class="sub-desc">The <i>raw</i> value of the group field.</p></li>\r
-     * <li><b>text</b> : String<p class="sub-desc">The configured header (as described in <tt>{@link #showGroupName})</tt>\r
-     * if <tt>{@link #showGroupName}</tt> is <tt>true</tt>) plus the <i>rendered</i> group field value.</p></li>\r
-     * <li><b>groupId</b> : String<p class="sub-desc">A unique, generated ID which is applied to the\r
-     * View Element which contains the group.</p></li>\r
-     * <li><b>startRow</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>\r
-     * <li><b>rs</b> : Array<p class="sub-desc">Contains a single element: The Record providing the data\r
-     * for the row which caused group change.</p></li>\r
-     * <li><b>cls</b> : String<p class="sub-desc">The generated class name string to apply to the group header Element.</p></li>\r
-     * <li><b>style</b> : String<p class="sub-desc">The inline style rules to apply to the group header Element.</p></li>\r
-     * </ul></div></p>\r
-     * See {@link Ext.XTemplate} for information on how to format data using a template. Possible usage:<pre><code>\r
-var grid = new Ext.grid.GridPanel({\r
-    ...\r
-    view: new Ext.grid.GroupingView({\r
-        groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
-    }),\r
-});\r
-     * </code></pre>\r
-     */\r
-    groupTextTpl : '{text}',\r
-\r
-    <div id="cfg-Ext.grid.GroupingView-groupMode"></div>/**\r
-     * @cfg {String} groupMode Indicates how to construct the group identifier. <tt>'value'</tt> constructs the id using\r
-     * raw value, <tt>'display'</tt> constructs the id using the rendered value. Defaults to <tt>'value'</tt>.\r
-     */\r
-    groupMode: 'value',\r
-\r
-    <div id="cfg-Ext.grid.GroupingView-groupRenderer"></div>/**\r
-     * @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for\r
-     * each column.\r
-     */\r
-\r
-    // private\r
-    gidSeed : 1000,\r
-\r
-    // private\r
-    initTemplates : function(){\r
-        Ext.grid.GroupingView.superclass.initTemplates.call(this);\r
-        this.state = {};\r
-\r
-        var sm = this.grid.getSelectionModel();\r
-        sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',\r
-                this.onBeforeRowSelect, this);\r
-\r
-        if(!this.startGroup){\r
-            this.startGroup = new Ext.XTemplate(\r
-                '<div id="{groupId}" class="x-grid-group {cls}">',\r
-                    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',\r
-                    '<div id="{groupId}-bd" class="x-grid-group-body">'\r
-            );\r
-        }\r
-        this.startGroup.compile();\r
-        if(!this.endGroup){\r
-            this.endGroup = '</div></div>';\r
-        }\r
-\r
-        this.endGroup = '</div></div>';\r
-    },\r
-\r
-    // private\r
-    findGroup : function(el){\r
-        return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);\r
-    },\r
-\r
-    // private\r
-    getGroups : function(){\r
-        return this.hasRows() ? this.mainBody.dom.childNodes : [];\r
-    },\r
-\r
-    // private\r
-    onAdd : function(){\r
-        if(this.canGroup() && !this.ignoreAdd){\r
-            var ss = this.getScrollState();\r
-            this.refresh();\r
-            this.restoreScroll(ss);\r
-        }else if(!this.canGroup()){\r
-            Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRemove : function(ds, record, index, isUpdate){\r
-        Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);\r
-        var g = document.getElementById(record._groupId);\r
-        if(g && g.childNodes[1].childNodes.length < 1){\r
-            Ext.removeNode(g);\r
-        }\r
-        this.applyEmptyText();\r
-    },\r
-\r
-    // private\r
-    refreshRow : function(record){\r
-        if(this.ds.getCount()==1){\r
-            this.refresh();\r
-        }else{\r
-            this.isUpdating = true;\r
-            Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);\r
-            this.isUpdating = false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeMenuShow : function(){\r
-        var item, items = this.hmenu.items, disabled = this.cm.config[this.hdCtxIndex].groupable === false;\r
-        if((item = items.get('groupBy'))){\r
-            item.setDisabled(disabled);\r
-        }\r
-        if((item = items.get('showGroups'))){\r
-            item.setDisabled(disabled);\r
-            item.setChecked(this.enableGrouping, true);\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderUI : function(){\r
-        Ext.grid.GroupingView.superclass.renderUI.call(this);\r
-        this.mainBody.on('mousedown', this.interceptMouse, this);\r
-\r
-        if(this.enableGroupingMenu && this.hmenu){\r
-            this.hmenu.add('-',{\r
-                itemId:'groupBy',\r
-                text: this.groupByText,\r
-                handler: this.onGroupByClick,\r
-                scope: this,\r
-                iconCls:'x-group-by-icon'\r
-            });\r
-            if(this.enableNoGroups){\r
-                this.hmenu.add({\r
-                    itemId:'showGroups',\r
-                    text: this.showGroupsText,\r
-                    checked: true,\r
-                    checkHandler: this.onShowGroupsClick,\r
-                    scope: this\r
-                });\r
-            }\r
-            this.hmenu.on('beforeshow', this.beforeMenuShow, this);\r
-        }\r
-    },\r
-\r
-    processEvent: function(name, e){\r
-        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);\r
-        if(hd){\r
-            // group value is at the end of the string\r
-            var field = this.getGroupField(),\r
-                prefix = this.getPrefix(field),\r
-                groupValue = hd.id.substring(prefix.length);\r
-\r
-            // remove trailing '-hd'\r
-            groupValue = groupValue.substr(0, groupValue.length - 3);\r
-            if(groupValue){\r
-                this.grid.fireEvent('group' + name, this.grid, field, groupValue, e);\r
-            }\r
-        }\r
-\r
-    },\r
-\r
-    // private\r
-    onGroupByClick : function(){\r
-        this.enableGrouping = true;\r
-        this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));\r
-        this.grid.fireEvent('groupchange', this, this.grid.store.getGroupState());\r
-        this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups\r
-        this.refresh();\r
-    },\r
-\r
-    // private\r
-    onShowGroupsClick : function(mi, checked){\r
-    this.enableGrouping = checked;\r
-        if(checked){\r
-            this.onGroupByClick();\r
-        }else{\r
-            this.grid.store.clearGrouping();\r
-            this.grid.fireEvent('groupchange', this, null);\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-toggleRowIndex"></div>/**\r
-     * Toggle the group that contains the specific row.\r
-     * @param {Number} rowIndex The row inside the group\r
-     * @param {Boolean} expanded (optional)\r
-     */\r
-    toggleRowIndex : function(rowIndex, expanded){\r
-        if(!this.canGroup()){\r
-            return;\r
-        }\r
-        var row = this.getRow(rowIndex);\r
-        if(row){\r
-            this.toggleGroup(this.findGroup(row), expanded);\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-toggleGroup"></div>/**\r
-     * Toggles the specified group if no value is passed, otherwise sets the expanded state of the group to the value passed.\r
-     * @param {String} groupId The groupId assigned to the group (see getGroupId)\r
-     * @param {Boolean} expanded (optional)\r
-     */\r
-    toggleGroup : function(group, expanded){\r
-        var gel = Ext.get(group);\r
-        expanded = Ext.isDefined(expanded) ? expanded : gel.hasClass('x-grid-group-collapsed');\r
-        if(this.state[gel.id] !== expanded){\r
-            this.grid.stopEditing(true);\r
-            this.state[gel.id] = expanded;\r
-            gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-toggleAllGroups"></div>/**\r
-     * Toggles all groups if no value is passed, otherwise sets the expanded state of all groups to the value passed.\r
-     * @param {Boolean} expanded (optional)\r
-     */\r
-    toggleAllGroups : function(expanded){\r
-        var groups = this.getGroups();\r
-        for(var i = 0, len = groups.length; i < len; i++){\r
-            this.toggleGroup(groups[i], expanded);\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-expandAllGroups"></div>/**\r
-     * Expands all grouped rows.\r
-     */\r
-    expandAllGroups : function(){\r
-        this.toggleAllGroups(true);\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-collapseAllGroups"></div>/**\r
-     * Collapses all grouped rows.\r
-     */\r
-    collapseAllGroups : function(){\r
-        this.toggleAllGroups(false);\r
-    },\r
-\r
-    // private\r
-    interceptMouse : function(e){\r
-        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);\r
-        if(hd){\r
-            e.stopEvent();\r
-            this.toggleGroup(hd.parentNode);\r
-        }\r
-    },\r
-\r
-    // private\r
-    getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){\r
-        var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);\r
-        if(g === '' || g === '&#160;'){\r
-            g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;\r
-        }\r
-        return g;\r
-    },\r
-\r
-    // private\r
-    getGroupField : function(){\r
-        return this.grid.store.getGroupState();\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        if(!this.ds || !this.cm){\r
-            return;\r
-        }\r
-        Ext.grid.GroupingView.superclass.afterRender.call(this);\r
-        if(this.grid.deferRowRender){\r
-            this.updateGroupWidths();\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderRows : function(){\r
-        var groupField = this.getGroupField();\r
-        var eg = !!groupField;\r
-        // if they turned off grouping and the last grouped field is hidden\r
-        if(this.hideGroupedColumn) {\r
-            var colIndex = this.cm.findColumnIndex(groupField),\r
-                hasLastGroupField = Ext.isDefined(this.lastGroupField);\r
-            if(!eg && hasLastGroupField){\r
-                this.mainBody.update('');\r
-                this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);\r
-                delete this.lastGroupField;\r
-            }else if (eg && !hasLastGroupField){\r
-                this.lastGroupField = groupField;\r
-                this.cm.setHidden(colIndex, true);\r
-            }else if (eg && hasLastGroupField && groupField !== this.lastGroupField) {\r
-                this.mainBody.update('');\r
-                var oldIndex = this.cm.findColumnIndex(this.lastGroupField);\r
-                this.cm.setHidden(oldIndex, false);\r
-                this.lastGroupField = groupField;\r
-                this.cm.setHidden(colIndex, true);\r
-            }\r
-        }\r
-        return Ext.grid.GroupingView.superclass.renderRows.apply(\r
-                    this, arguments);\r
-    },\r
-\r
-    // private\r
-    doRender : function(cs, rs, ds, startRow, colCount, stripe){\r
-        if(rs.length < 1){\r
-            return '';\r
-        }\r
-\r
-        if(!this.canGroup() || this.isUpdating){\r
-            return Ext.grid.GroupingView.superclass.doRender.apply(\r
-                    this, arguments);\r
-        }\r
-\r
-        var groupField = this.getGroupField(),\r
-            colIndex = this.cm.findColumnIndex(groupField),\r
-            g,\r
-            gstyle = 'width:' + this.getTotalWidth() + ';',\r
-            cfg = this.cm.config[colIndex],\r
-            groupRenderer = cfg.groupRenderer || cfg.renderer,\r
-            prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '',\r
-            groups = [],\r
-            curGroup, i, len, gid;\r
-\r
-        for(i = 0, len = rs.length; i < len; i++){\r
-            var rowIndex = startRow + i,\r
-                r = rs[i],\r
-                gvalue = r.data[groupField];\r
-\r
-                g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);\r
-            if(!curGroup || curGroup.group != g){\r
-                gid = this.constructId(gvalue, groupField, colIndex);\r
-                // if state is defined use it, however state is in terms of expanded\r
-                // so negate it, otherwise use the default.\r
-                this.state[gid] = !(Ext.isDefined(this.state[gid]) ? !this.state[gid] : this.startCollapsed);\r
-                curGroup = {\r
-                    group: g,\r
-                    gvalue: gvalue,\r
-                    text: prefix + g,\r
-                    groupId: gid,\r
-                    startRow: rowIndex,\r
-                    rs: [r],\r
-                    cls: this.state[gid] ? '' : 'x-grid-group-collapsed',\r
-                    style: gstyle\r
-                };\r
-                groups.push(curGroup);\r
-            }else{\r
-                curGroup.rs.push(r);\r
-            }\r
-            r._groupId = gid;\r
-        }\r
-\r
-        var buf = [];\r
-        for(i = 0, len = groups.length; i < len; i++){\r
-            g = groups[i];\r
-            this.doGroupStart(buf, g, cs, ds, colCount);\r
-            buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(\r
-                    this, cs, g.rs, ds, g.startRow, colCount, stripe);\r
-\r
-            this.doGroupEnd(buf, g, cs, ds, colCount);\r
-        }\r
-        return buf.join('');\r
-    },\r
-\r
-    <div id="method-Ext.grid.GroupingView-getGroupId"></div>/**\r
-     * Dynamically tries to determine the groupId of a specific value\r
-     * @param {String} value\r
-     * @return {String} The group id\r
-     */\r
-    getGroupId : function(value){\r
-        var field = this.getGroupField();\r
-        return this.constructId(value, field, this.cm.findColumnIndex(field));\r
-    },\r
-\r
-    // private\r
-    constructId : function(value, field, idx){\r
-        var cfg = this.cm.config[idx],\r
-            groupRenderer = cfg.groupRenderer || cfg.renderer,\r
-            val = (this.groupMode == 'value') ? value : this.getGroup(value, {data:{}}, groupRenderer, 0, idx, this.ds);\r
-\r
-        return this.getPrefix(field) + Ext.util.Format.htmlEncode(val);\r
-    },\r
-\r
-    // private\r
-    canGroup  : function(){\r
-        return this.enableGrouping && !!this.getGroupField();\r
-    },\r
-\r
-    // private\r
-    getPrefix: function(field){\r
-        return this.grid.getGridEl().id + '-gp-' + field + '-';\r
-    },\r
-\r
-    // private\r
-    doGroupStart : function(buf, g, cs, ds, colCount){\r
-        buf[buf.length] = this.startGroup.apply(g);\r
-    },\r
-\r
-    // private\r
-    doGroupEnd : function(buf, g, cs, ds, colCount){\r
-        buf[buf.length] = this.endGroup;\r
-    },\r
-\r
-    // private\r
-    getRows : function(){\r
-        if(!this.canGroup()){\r
-            return Ext.grid.GroupingView.superclass.getRows.call(this);\r
-        }\r
-        var r = [];\r
-        var g, gs = this.getGroups();\r
-        for(var i = 0, len = gs.length; i < len; i++){\r
-            g = gs[i].childNodes[1].childNodes;\r
-            for(var j = 0, jlen = g.length; j < jlen; j++){\r
-                r[r.length] = g[j];\r
-            }\r
-        }\r
-        return r;\r
-    },\r
-\r
-    // private\r
-    updateGroupWidths : function(){\r
-        if(!this.canGroup() || !this.hasRows()){\r
-            return;\r
-        }\r
-        var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px';\r
-        var gs = this.getGroups();\r
-        for(var i = 0, len = gs.length; i < len; i++){\r
-            gs[i].firstChild.style.width = tw;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onColumnWidthUpdated : function(col, w, tw){\r
-        Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, col, w, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onAllColumnWidthsUpdated : function(ws, tw){\r
-        Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, ws, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onColumnHiddenUpdated : function(col, hidden, tw){\r
-        Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, col, hidden, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onLayout : function(){\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onBeforeRowSelect : function(sm, rowIndex){\r
-        this.toggleRowIndex(rowIndex, true);\r
-    }\r
-});\r
-// private\r
-Ext.grid.GroupingView.GROUP_ID = 1000;</pre>    \r
-</body>\r
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
+  <title>The source code</title>
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body  onload="prettyPrint();">
+    <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.2.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.grid.GroupingView"></div>/**
+ * @class Ext.grid.GroupingView
+ * @extends Ext.grid.GridView
+ * Adds the ability for single level grouping to the grid. A {@link Ext.data.GroupingStore GroupingStore}
+ * must be used to enable grouping.  Some grouping characteristics may also be configured at the
+ * {@link Ext.grid.Column Column level}<div class="mdetail-params"><ul>
+ * <li><code>{@link Ext.grid.Column#emptyGroupText emptyGroupText}</code></li>
+ * <li><code>{@link Ext.grid.Column#groupable groupable}</code></li>
+ * <li><code>{@link Ext.grid.Column#groupName groupName}</code></li>
+ * <li><code>{@link Ext.grid.Column#groupRender groupRender}</code></li>
+ * </ul></div>
+ * <p>Sample usage:</p>
+ * <pre><code>
+var grid = new Ext.grid.GridPanel({
+    // A groupingStore is required for a GroupingView
+    store: new {@link Ext.data.GroupingStore}({
+        autoDestroy: true,
+        reader: reader,
+        data: xg.dummyData,
+        sortInfo: {field: 'company', direction: 'ASC'},
+        {@link Ext.data.GroupingStore#groupOnSort groupOnSort}: true,
+        {@link Ext.data.GroupingStore#remoteGroup remoteGroup}: true,
+        {@link Ext.data.GroupingStore#groupField groupField}: 'industry'
+    }),
+    colModel: new {@link Ext.grid.ColumnModel}({
+        columns:[
+            {id:'company',header: 'Company', width: 60, dataIndex: 'company'},
+            // {@link Ext.grid.Column#groupable groupable}, {@link Ext.grid.Column#groupName groupName}, {@link Ext.grid.Column#groupRender groupRender} are also configurable at column level
+            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price', {@link Ext.grid.Column#groupable groupable}: false},
+            {header: 'Change', dataIndex: 'change', renderer: Ext.util.Format.usMoney},
+            {header: 'Industry', dataIndex: 'industry'},
+            {header: 'Last Updated', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
+        ],
+        defaults: {
+            sortable: true,
+            menuDisabled: false,
+            width: 20
+        }
+    }),
+
+    view: new Ext.grid.GroupingView({
+        {@link Ext.grid.GridView#forceFit forceFit}: true,
+        // custom grouping text template to display the number of items per group
+        {@link #groupTextTpl}: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
+    }),
+
+    frame:true,
+    width: 700,
+    height: 450,
+    collapsible: true,
+    animCollapse: false,
+    title: 'Grouping Example',
+    iconCls: 'icon-grid',
+    renderTo: document.body
+});
+ * </code></pre>
+ * @constructor
+ * @param {Object} config
+ */
+Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {
+
+    <div id="cfg-Ext.grid.GroupingView-groupByText"></div>/**
+     * @cfg {String} groupByText Text displayed in the grid header menu for grouping by a column
+     * (defaults to 'Group By This Field').
+     */
+    groupByText : 'Group By This Field',
+    <div id="cfg-Ext.grid.GroupingView-showGroupsText"></div>/**
+     * @cfg {String} showGroupsText Text displayed in the grid header for enabling/disabling grouping
+     * (defaults to 'Show in Groups').
+     */
+    showGroupsText : 'Show in Groups',
+    <div id="cfg-Ext.grid.GroupingView-hideGroupedColumn"></div>/**
+     * @cfg {Boolean} hideGroupedColumn <tt>true</tt> to hide the column that is currently grouped (defaults to <tt>false</tt>)
+     */
+    hideGroupedColumn : false,
+    <div id="cfg-Ext.grid.GroupingView-showGroupName"></div>/**
+     * @cfg {Boolean} showGroupName If <tt>true</tt> will display a prefix plus a ': ' before the group field value
+     * in the group header line.  The prefix will consist of the <tt><b>{@link Ext.grid.Column#groupName groupName}</b></tt>
+     * (or the configured <tt><b>{@link Ext.grid.Column#header header}</b></tt> if not provided) configured in the
+     * {@link Ext.grid.Column} for each set of grouped rows (defaults to <tt>true</tt>).
+     */
+    showGroupName : true,
+    <div id="cfg-Ext.grid.GroupingView-startCollapsed"></div>/**
+     * @cfg {Boolean} startCollapsed <tt>true</tt> to start all groups collapsed (defaults to <tt>false</tt>)
+     */
+    startCollapsed : false,
+    <div id="cfg-Ext.grid.GroupingView-enableGrouping"></div>/**
+     * @cfg {Boolean} enableGrouping <tt>false</tt> to disable grouping functionality (defaults to <tt>true</tt>)
+     */
+    enableGrouping : true,
+    <div id="cfg-Ext.grid.GroupingView-enableGroupingMenu"></div>/**
+     * @cfg {Boolean} enableGroupingMenu <tt>true</tt> to enable the grouping control in the column menu (defaults to <tt>true</tt>)
+     */
+    enableGroupingMenu : true,
+    <div id="cfg-Ext.grid.GroupingView-enableNoGroups"></div>/**
+     * @cfg {Boolean} enableNoGroups <tt>true</tt> to allow the user to turn off grouping (defaults to <tt>true</tt>)
+     */
+    enableNoGroups : true,
+    <div id="cfg-Ext.grid.GroupingView-emptyGroupText"></div>/**
+     * @cfg {String} emptyGroupText The text to display when there is an empty group value (defaults to <tt>'(None)'</tt>).
+     * May also be specified per column, see {@link Ext.grid.Column}.{@link Ext.grid.Column#emptyGroupText emptyGroupText}.
+     */
+    emptyGroupText : '(None)',
+    <div id="cfg-Ext.grid.GroupingView-ignoreAdd"></div>/**
+     * @cfg {Boolean} ignoreAdd <tt>true</tt> to skip refreshing the view when new rows are added (defaults to <tt>false</tt>)
+     */
+    ignoreAdd : false,
+    <div id="cfg-Ext.grid.GroupingView-groupTextTpl"></div>/**
+     * @cfg {String} groupTextTpl The template used to render the group header (defaults to <tt>'{text}'</tt>).
+     * This is used to format an object which contains the following properties:
+     * <div class="mdetail-params"><ul>
+     * <li><b>group</b> : String<p class="sub-desc">The <i>rendered</i> value of the group field.
+     * By default this is the unchanged value of the group field. If a <tt><b>{@link Ext.grid.Column#groupRenderer groupRenderer}</b></tt>
+     * is specified, it is the result of a call to that function.</p></li>
+     * <li><b>gvalue</b> : Object<p class="sub-desc">The <i>raw</i> value of the group field.</p></li>
+     * <li><b>text</b> : String<p class="sub-desc">The configured header (as described in <tt>{@link #showGroupName})</tt>
+     * if <tt>{@link #showGroupName}</tt> is <tt>true</tt>) plus the <i>rendered</i> group field value.</p></li>
+     * <li><b>groupId</b> : String<p class="sub-desc">A unique, generated ID which is applied to the
+     * View Element which contains the group.</p></li>
+     * <li><b>startRow</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>
+     * <li><b>rs</b> : Array<p class="sub-desc">Contains a single element: The Record providing the data
+     * for the row which caused group change.</p></li>
+     * <li><b>cls</b> : String<p class="sub-desc">The generated class name string to apply to the group header Element.</p></li>
+     * <li><b>style</b> : String<p class="sub-desc">The inline style rules to apply to the group header Element.</p></li>
+     * </ul></div></p>
+     * See {@link Ext.XTemplate} for information on how to format data using a template. Possible usage:<pre><code>
+var grid = new Ext.grid.GridPanel({
+    ...
+    view: new Ext.grid.GroupingView({
+        groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
+    }),
+});
+     * </code></pre>
+     */
+    groupTextTpl : '{text}',
+
+    <div id="cfg-Ext.grid.GroupingView-groupMode"></div>/**
+     * @cfg {String} groupMode Indicates how to construct the group identifier. <tt>'value'</tt> constructs the id using
+     * raw value, <tt>'display'</tt> constructs the id using the rendered value. Defaults to <tt>'value'</tt>.
+     */
+    groupMode: 'value',
+
+    <div id="cfg-Ext.grid.GroupingView-groupRenderer"></div>/**
+     * @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for
+     * each column.
+     */
+
+    // private
+    initTemplates : function(){
+        Ext.grid.GroupingView.superclass.initTemplates.call(this);
+        this.state = {};
+
+        var sm = this.grid.getSelectionModel();
+        sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',
+                this.onBeforeRowSelect, this);
+
+        if(!this.startGroup){
+            this.startGroup = new Ext.XTemplate(
+                '<div id="{groupId}" class="x-grid-group {cls}">',
+                    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',
+                    '<div id="{groupId}-bd" class="x-grid-group-body">'
+            );
+        }
+        this.startGroup.compile();
+
+        if (!this.endGroup) {
+            this.endGroup = '</div></div>';
+        }
+    },
+
+    // private
+    findGroup : function(el){
+        return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);
+    },
+
+    // private
+    getGroups : function(){
+        return this.hasRows() ? this.mainBody.dom.childNodes : [];
+    },
+
+    // private
+    onAdd : function(ds, records, index) {
+        if (this.canGroup() && !this.ignoreAdd) {
+            var ss = this.getScrollState();
+            this.fireEvent('beforerowsinserted', ds, index, index + (records.length-1));
+            this.refresh();
+            this.restoreScroll(ss);
+            this.fireEvent('rowsinserted', ds, index, index + (records.length-1));
+        } else if (!this.canGroup()) {
+            Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);
+        }
+    },
+
+    // private
+    onRemove : function(ds, record, index, isUpdate){
+        Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);
+        var g = document.getElementById(record._groupId);
+        if(g && g.childNodes[1].childNodes.length < 1){
+            Ext.removeNode(g);
+        }
+        this.applyEmptyText();
+    },
+
+    // private
+    refreshRow : function(record){
+        if(this.ds.getCount()==1){
+            this.refresh();
+        }else{
+            this.isUpdating = true;
+            Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);
+            this.isUpdating = false;
+        }
+    },
+
+    // private
+    beforeMenuShow : function(){
+        var item, items = this.hmenu.items, disabled = this.cm.config[this.hdCtxIndex].groupable === false;
+        if((item = items.get('groupBy'))){
+            item.setDisabled(disabled);
+        }
+        if((item = items.get('showGroups'))){
+            item.setDisabled(disabled);
+            item.setChecked(this.enableGrouping, true);
+        }
+    },
+
+    // private
+    renderUI : function(){
+        Ext.grid.GroupingView.superclass.renderUI.call(this);
+        this.mainBody.on('mousedown', this.interceptMouse, this);
+
+        if(this.enableGroupingMenu && this.hmenu){
+            this.hmenu.add('-',{
+                itemId:'groupBy',
+                text: this.groupByText,
+                handler: this.onGroupByClick,
+                scope: this,
+                iconCls:'x-group-by-icon'
+            });
+            if(this.enableNoGroups){
+                this.hmenu.add({
+                    itemId:'showGroups',
+                    text: this.showGroupsText,
+                    checked: true,
+                    checkHandler: this.onShowGroupsClick,
+                    scope: this
+                });
+            }
+            this.hmenu.on('beforeshow', this.beforeMenuShow, this);
+        }
+    },
+
+    processEvent: function(name, e){
+        Ext.grid.GroupingView.superclass.processEvent.call(this, name, e);
+        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);
+        if(hd){
+            // group value is at the end of the string
+            var field = this.getGroupField(),
+                prefix = this.getPrefix(field),
+                groupValue = hd.id.substring(prefix.length);
+
+            // remove trailing '-hd'
+            groupValue = groupValue.substr(0, groupValue.length - 3);
+            if(groupValue){
+                this.grid.fireEvent('group' + name, this.grid, field, groupValue, e);
+            }
+        }
+
+    },
+
+    // private
+    onGroupByClick : function(){
+        this.enableGrouping = true;
+        this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));
+        this.grid.fireEvent('groupchange', this, this.grid.store.getGroupState());
+        this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups
+        this.refresh();
+    },
+
+    // private
+    onShowGroupsClick : function(mi, checked){
+        this.enableGrouping = checked;
+        if(checked){
+            this.onGroupByClick();
+        }else{
+            this.grid.store.clearGrouping();
+            this.grid.fireEvent('groupchange', this, null);
+        }
+    },
+
+    <div id="method-Ext.grid.GroupingView-toggleRowIndex"></div>/**
+     * Toggle the group that contains the specific row.
+     * @param {Number} rowIndex The row inside the group
+     * @param {Boolean} expanded (optional)
+     */
+    toggleRowIndex : function(rowIndex, expanded){
+        if(!this.canGroup()){
+            return;
+        }
+        var row = this.getRow(rowIndex);
+        if(row){
+            this.toggleGroup(this.findGroup(row), expanded);
+        }
+    },
+
+    <div id="method-Ext.grid.GroupingView-toggleGroup"></div>/**
+     * Toggles the specified group if no value is passed, otherwise sets the expanded state of the group to the value passed.
+     * @param {String} groupId The groupId assigned to the group (see getGroupId)
+     * @param {Boolean} expanded (optional)
+     */
+    toggleGroup : function(group, expanded){
+        var gel = Ext.get(group);
+        expanded = Ext.isDefined(expanded) ? expanded : gel.hasClass('x-grid-group-collapsed');
+        if(this.state[gel.id] !== expanded){
+            this.grid.stopEditing(true);
+            this.state[gel.id] = expanded;
+            gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');
+        }
+    },
+
+    <div id="method-Ext.grid.GroupingView-toggleAllGroups"></div>/**
+     * Toggles all groups if no value is passed, otherwise sets the expanded state of all groups to the value passed.
+     * @param {Boolean} expanded (optional)
+     */
+    toggleAllGroups : function(expanded){
+        var groups = this.getGroups();
+        for(var i = 0, len = groups.length; i < len; i++){
+            this.toggleGroup(groups[i], expanded);
+        }
+    },
+
+    <div id="method-Ext.grid.GroupingView-expandAllGroups"></div>/**
+     * Expands all grouped rows.
+     */
+    expandAllGroups : function(){
+        this.toggleAllGroups(true);
+    },
+
+    <div id="method-Ext.grid.GroupingView-collapseAllGroups"></div>/**
+     * Collapses all grouped rows.
+     */
+    collapseAllGroups : function(){
+        this.toggleAllGroups(false);
+    },
+
+    // private
+    interceptMouse : function(e){
+        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);
+        if(hd){
+            e.stopEvent();
+            this.toggleGroup(hd.parentNode);
+        }
+    },
+
+    // private
+    getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){
+        var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);
+        if(g === '' || g === '&#160;'){
+            g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;
+        }
+        return g;
+    },
+
+    // private
+    getGroupField : function(){
+        return this.grid.store.getGroupState();
+    },
+
+    // private
+    afterRender : function(){
+        if(!this.ds || !this.cm){
+            return;
+        }
+        Ext.grid.GroupingView.superclass.afterRender.call(this);
+        if(this.grid.deferRowRender){
+            this.updateGroupWidths();
+        }
+    },
+
+    // private
+    renderRows : function(){
+        var groupField = this.getGroupField();
+        var eg = !!groupField;
+        // if they turned off grouping and the last grouped field is hidden
+        if(this.hideGroupedColumn) {
+            var colIndex = this.cm.findColumnIndex(groupField),
+                hasLastGroupField = Ext.isDefined(this.lastGroupField);
+            if(!eg && hasLastGroupField){
+                this.mainBody.update('');
+                this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);
+                delete this.lastGroupField;
+            }else if (eg && !hasLastGroupField){
+                this.lastGroupField = groupField;
+                this.cm.setHidden(colIndex, true);
+            }else if (eg && hasLastGroupField && groupField !== this.lastGroupField) {
+                this.mainBody.update('');
+                var oldIndex = this.cm.findColumnIndex(this.lastGroupField);
+                this.cm.setHidden(oldIndex, false);
+                this.lastGroupField = groupField;
+                this.cm.setHidden(colIndex, true);
+            }
+        }
+        return Ext.grid.GroupingView.superclass.renderRows.apply(
+                    this, arguments);
+    },
+
+    // private
+    doRender : function(cs, rs, ds, startRow, colCount, stripe){
+        if(rs.length < 1){
+            return '';
+        }
+
+        if(!this.canGroup() || this.isUpdating){
+            return Ext.grid.GroupingView.superclass.doRender.apply(this, arguments);
+        }
+
+        var groupField = this.getGroupField(),
+            colIndex = this.cm.findColumnIndex(groupField),
+            g,
+            gstyle = 'width:' + this.getTotalWidth() + ';',
+            cfg = this.cm.config[colIndex],
+            groupRenderer = cfg.groupRenderer || cfg.renderer,
+            prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '',
+            groups = [],
+            curGroup, i, len, gid;
+
+        for(i = 0, len = rs.length; i < len; i++){
+            var rowIndex = startRow + i,
+                r = rs[i],
+                gvalue = r.data[groupField];
+
+                g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);
+            if(!curGroup || curGroup.group != g){
+                gid = this.constructId(gvalue, groupField, colIndex);
+                // if state is defined use it, however state is in terms of expanded
+                // so negate it, otherwise use the default.
+                this.state[gid] = !(Ext.isDefined(this.state[gid]) ? !this.state[gid] : this.startCollapsed);
+                curGroup = {
+                    group: g,
+                    gvalue: gvalue,
+                    text: prefix + g,
+                    groupId: gid,
+                    startRow: rowIndex,
+                    rs: [r],
+                    cls: this.state[gid] ? '' : 'x-grid-group-collapsed',
+                    style: gstyle
+                };
+                groups.push(curGroup);
+            }else{
+                curGroup.rs.push(r);
+            }
+            r._groupId = gid;
+        }
+
+        var buf = [];
+        for(i = 0, len = groups.length; i < len; i++){
+            g = groups[i];
+            this.doGroupStart(buf, g, cs, ds, colCount);
+            buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(
+                    this, cs, g.rs, ds, g.startRow, colCount, stripe);
+
+            this.doGroupEnd(buf, g, cs, ds, colCount);
+        }
+        return buf.join('');
+    },
+
+    <div id="method-Ext.grid.GroupingView-getGroupId"></div>/**
+     * Dynamically tries to determine the groupId of a specific value
+     * @param {String} value
+     * @return {String} The group id
+     */
+    getGroupId : function(value){
+        var field = this.getGroupField();
+        return this.constructId(value, field, this.cm.findColumnIndex(field));
+    },
+
+    // private
+    constructId : function(value, field, idx){
+        var cfg = this.cm.config[idx],
+            groupRenderer = cfg.groupRenderer || cfg.renderer,
+            val = (this.groupMode == 'value') ? value : this.getGroup(value, {data:{}}, groupRenderer, 0, idx, this.ds);
+
+        return this.getPrefix(field) + Ext.util.Format.htmlEncode(val);
+    },
+
+    // private
+    canGroup  : function(){
+        return this.enableGrouping && !!this.getGroupField();
+    },
+
+    // private
+    getPrefix: function(field){
+        return this.grid.getGridEl().id + '-gp-' + field + '-';
+    },
+
+    // private
+    doGroupStart : function(buf, g, cs, ds, colCount){
+        buf[buf.length] = this.startGroup.apply(g);
+    },
+
+    // private
+    doGroupEnd : function(buf, g, cs, ds, colCount){
+        buf[buf.length] = this.endGroup;
+    },
+
+    // private
+    getRows : function(){
+        if(!this.canGroup()){
+            return Ext.grid.GroupingView.superclass.getRows.call(this);
+        }
+        var r = [],
+            gs = this.getGroups(),
+            g,
+            i = 0,
+            len = gs.length,
+            j,
+            jlen;
+        for(; i < len; ++i){
+            g = gs[i].childNodes[1];
+            if(g){
+                g = g.childNodes;
+                for(j = 0, jlen = g.length; j < jlen; ++j){
+                    r[r.length] = g[j];
+                }
+            }
+        }
+        return r;
+    },
+
+    // private
+    updateGroupWidths : function(){
+        if(!this.canGroup() || !this.hasRows()){
+            return;
+        }
+        var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px';
+        var gs = this.getGroups();
+        for(var i = 0, len = gs.length; i < len; i++){
+            gs[i].firstChild.style.width = tw;
+        }
+    },
+
+    // private
+    onColumnWidthUpdated : function(col, w, tw){
+        Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, col, w, tw);
+        this.updateGroupWidths();
+    },
+
+    // private
+    onAllColumnWidthsUpdated : function(ws, tw){
+        Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, ws, tw);
+        this.updateGroupWidths();
+    },
+
+    // private
+    onColumnHiddenUpdated : function(col, hidden, tw){
+        Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, col, hidden, tw);
+        this.updateGroupWidths();
+    },
+
+    // private
+    onLayout : function(){
+        this.updateGroupWidths();
+    },
+
+    // private
+    onBeforeRowSelect : function(sm, rowIndex){
+        this.toggleRowIndex(rowIndex, true);
+    }
+});
+// private
+Ext.grid.GroupingView.GROUP_ID = 1000;</pre>    
+</body>
 </html>
\ No newline at end of file