Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / source / GroupingView.html
1 <html>
2 <head>
3   <title>The source code</title>
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
6 </head>
7 <body  onload="prettyPrint();">
8     <pre class="prettyprint lang-js">/*!
9  * Ext JS Library 3.0.3
10  * Copyright(c) 2006-2009 Ext JS, LLC
11  * licensing@extjs.com
12  * http://www.extjs.com/license
13  */
14 <div id="cls-Ext.grid.GroupingView"></div>/**\r
15  * @class Ext.grid.GroupingView\r
16  * @extends Ext.grid.GridView\r
17  * Adds the ability for single level grouping to the grid. A {@link Ext.data.GroupingStore GroupingStore}\r
18  * must be used to enable grouping.  Some grouping characteristics may also be configured at the\r
19  * {@link Ext.grid.Column Column level}<div class="mdetail-params"><ul>\r
20  * <li><code>{@link Ext.grid.Column#emptyGroupText emptyGroupText}</li>\r
21  * <li><code>{@link Ext.grid.Column#groupable groupable}</li>\r
22  * <li><code>{@link Ext.grid.Column#groupName groupName}</li>\r
23  * <li><code>{@link Ext.grid.Column#groupRender groupRender}</li>\r
24  * </ul></div>\r
25  * <p>Sample usage:</p>\r
26  * <pre><code>\r
27 var grid = new Ext.grid.GridPanel({\r
28     // A groupingStore is required for a GroupingView\r
29     store: new {@link Ext.data.GroupingStore}({\r
30         autoDestroy: true,\r
31         reader: reader,\r
32         data: xg.dummyData,\r
33         sortInfo: {field: 'company', direction: 'ASC'},\r
34         {@link Ext.data.GroupingStore#groupOnSort groupOnSort}: true,\r
35         {@link Ext.data.GroupingStore#remoteGroup remoteGroup}: true,\r
36         {@link Ext.data.GroupingStore#groupField groupField}: 'industry'\r
37     }),\r
38     colModel: new {@link Ext.grid.ColumnModel}({\r
39         columns:[\r
40             {id:'company',header: 'Company', width: 60, dataIndex: 'company'},\r
41             // {@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
42             {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price', {@link Ext.grid.Column#groupable groupable}: false},\r
43             {header: 'Change', dataIndex: 'change', renderer: Ext.util.Format.usMoney},\r
44             {header: 'Industry', dataIndex: 'industry'},\r
45             {header: 'Last Updated', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}\r
46         ],\r
47         defaults: {\r
48             sortable: true,\r
49             menuDisabled: false,\r
50             width: 20\r
51         }\r
52     }),\r
53 \r
54     view: new Ext.grid.GroupingView({\r
55         {@link Ext.grid.GridView#forceFit forceFit}: true,\r
56         // custom grouping text template to display the number of items per group\r
57         {@link #groupTextTpl}: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
58     }),\r
59 \r
60     frame:true,\r
61     width: 700,\r
62     height: 450,\r
63     collapsible: true,\r
64     animCollapse: false,\r
65     title: 'Grouping Example',\r
66     iconCls: 'icon-grid',\r
67     renderTo: document.body\r
68 });\r
69  * </code></pre>\r
70  * @constructor\r
71  * @param {Object} config\r
72  */\r
73 Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {\r
74 \r
75     <div id="cfg-Ext.grid.GroupingView-groupByText"></div>/**\r
76      * @cfg {String} groupByText Text displayed in the grid header menu for grouping by a column\r
77      * (defaults to 'Group By This Field').\r
78      */\r
79     groupByText : 'Group By This Field',\r
80     <div id="cfg-Ext.grid.GroupingView-showGroupsText"></div>/**\r
81      * @cfg {String} showGroupsText Text displayed in the grid header for enabling/disabling grouping\r
82      * (defaults to 'Show in Groups').\r
83      */\r
84     showGroupsText : 'Show in Groups',\r
85     <div id="cfg-Ext.grid.GroupingView-hideGroupedColumn"></div>/**\r
86      * @cfg {Boolean} hideGroupedColumn <tt>true</tt> to hide the column that is currently grouped (defaults to <tt>false</tt>)\r
87      */\r
88     hideGroupedColumn : false,\r
89     <div id="cfg-Ext.grid.GroupingView-showGroupName"></div>/**\r
90      * @cfg {Boolean} showGroupName If <tt>true</tt> will display a prefix plus a ': ' before the group field value\r
91      * in the group header line.  The prefix will consist of the <tt><b>{@link Ext.grid.Column#groupName groupName}</b></tt>\r
92      * (or the configured <tt><b>{@link Ext.grid.Column#header header}</b></tt> if not provided) configured in the\r
93      * {@link Ext.grid.Column} for each set of grouped rows (defaults to <tt>true</tt>).\r
94      */\r
95     showGroupName : true,\r
96     <div id="cfg-Ext.grid.GroupingView-startCollapsed"></div>/**\r
97      * @cfg {Boolean} startCollapsed <tt>true</tt> to start all groups collapsed (defaults to <tt>false</tt>)\r
98      */\r
99     startCollapsed : false,\r
100     <div id="cfg-Ext.grid.GroupingView-enableGrouping"></div>/**\r
101      * @cfg {Boolean} enableGrouping <tt>false</tt> to disable grouping functionality (defaults to <tt>true</tt>)\r
102      */\r
103     enableGrouping : true,\r
104     <div id="cfg-Ext.grid.GroupingView-enableGroupingMenu"></div>/**\r
105      * @cfg {Boolean} enableGroupingMenu <tt>true</tt> to enable the grouping control in the column menu (defaults to <tt>true</tt>)\r
106      */\r
107     enableGroupingMenu : true,\r
108     <div id="cfg-Ext.grid.GroupingView-enableNoGroups"></div>/**\r
109      * @cfg {Boolean} enableNoGroups <tt>true</tt> to allow the user to turn off grouping (defaults to <tt>true</tt>)\r
110      */\r
111     enableNoGroups : true,\r
112     <div id="cfg-Ext.grid.GroupingView-emptyGroupText"></div>/**\r
113      * @cfg {String} emptyGroupText The text to display when there is an empty group value (defaults to <tt>'(None)'</tt>).\r
114      * May also be specified per column, see {@link Ext.grid.Column}.{@link Ext.grid.Column#emptyGroupText emptyGroupText}.\r
115      */\r
116     emptyGroupText : '(None)',\r
117     <div id="cfg-Ext.grid.GroupingView-ignoreAdd"></div>/**\r
118      * @cfg {Boolean} ignoreAdd <tt>true</tt> to skip refreshing the view when new rows are added (defaults to <tt>false</tt>)\r
119      */\r
120     ignoreAdd : false,\r
121     <div id="cfg-Ext.grid.GroupingView-groupTextTpl"></div>/**\r
122      * @cfg {String} groupTextTpl The template used to render the group header (defaults to <tt>'{text}'</tt>).\r
123      * This is used to format an object which contains the following properties:\r
124      * <div class="mdetail-params"><ul>\r
125      * <li><b>group</b> : String<p class="sub-desc">The <i>rendered</i> value of the group field.\r
126      * By default this is the unchanged value of the group field. If a <tt><b>{@link Ext.grid.Column#groupRenderer groupRenderer}</b></tt>\r
127      * is specified, it is the result of a call to that function.</p></li>\r
128      * <li><b>gvalue</b> : Object<p class="sub-desc">The <i>raw</i> value of the group field.</p></li>\r
129      * <li><b>text</b> : String<p class="sub-desc">The configured header (as described in <tt>{@link #showGroupName})</tt>\r
130      * if <tt>{@link #showGroupName}</tt> is <tt>true</tt>) plus the <i>rendered</i> group field value.</p></li>\r
131      * <li><b>groupId</b> : String<p class="sub-desc">A unique, generated ID which is applied to the\r
132      * View Element which contains the group.</p></li>\r
133      * <li><b>startRow</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>\r
134      * <li><b>rs</b> : Array<p class="sub-desc">Contains a single element: The Record providing the data\r
135      * for the row which caused group change.</p></li>\r
136      * <li><b>cls</b> : String<p class="sub-desc">The generated class name string to apply to the group header Element.</p></li>\r
137      * <li><b>style</b> : String<p class="sub-desc">The inline style rules to apply to the group header Element.</p></li>\r
138      * </ul></div></p>\r
139      * See {@link Ext.XTemplate} for information on how to format data using a template. Possible usage:<pre><code>\r
140 var grid = new Ext.grid.GridPanel({\r
141     ...\r
142     view: new Ext.grid.GroupingView({\r
143         groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
144     }),\r
145 });\r
146      * </code></pre>\r
147      */\r
148     groupTextTpl : '{text}',\r
149     \r
150     <div id="cfg-Ext.grid.GroupingView-groupMode"></div>/**\r
151      * @cfg {String} groupMode Indicates how to construct the group identifier. <tt>'value'</tt> constructs the id using\r
152      * raw value, <tt>'display'</tt> constructs the id using the rendered value. Defaults to <tt>'value'</tt>.\r
153      */\r
154     groupMode: 'value',\r
155     \r
156     <div id="cfg-Ext.grid.GroupingView-groupRenderer"></div>/**\r
157      * @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for\r
158      * each column.\r
159      */\r
160 \r
161     // private\r
162     gidSeed : 1000,\r
163 \r
164     // private\r
165     initTemplates : function(){\r
166         Ext.grid.GroupingView.superclass.initTemplates.call(this);\r
167         this.state = {};\r
168 \r
169         var sm = this.grid.getSelectionModel();\r
170         sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',\r
171                 this.onBeforeRowSelect, this);\r
172 \r
173         if(!this.startGroup){\r
174             this.startGroup = new Ext.XTemplate(\r
175                 '<div id="{groupId}" class="x-grid-group {cls}">',\r
176                     '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',\r
177                     '<div id="{groupId}-bd" class="x-grid-group-body">'\r
178             );\r
179         }\r
180         this.startGroup.compile();\r
181         this.endGroup = '</div></div>';\r
182     },\r
183 \r
184     // private\r
185     findGroup : function(el){\r
186         return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);\r
187     },\r
188 \r
189     // private\r
190     getGroups : function(){\r
191         return this.hasRows() ? this.mainBody.dom.childNodes : [];\r
192     },\r
193 \r
194     // private\r
195     onAdd : function(){\r
196         if(this.enableGrouping && !this.ignoreAdd){\r
197             var ss = this.getScrollState();\r
198             this.refresh();\r
199             this.restoreScroll(ss);\r
200         }else if(!this.enableGrouping){\r
201             Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);\r
202         }\r
203     },\r
204 \r
205     // private\r
206     onRemove : function(ds, record, index, isUpdate){\r
207         Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);\r
208         var g = document.getElementById(record._groupId);\r
209         if(g && g.childNodes[1].childNodes.length < 1){\r
210             Ext.removeNode(g);\r
211         }\r
212         this.applyEmptyText();\r
213     },\r
214 \r
215     // private\r
216     refreshRow : function(record){\r
217         if(this.ds.getCount()==1){\r
218             this.refresh();\r
219         }else{\r
220             this.isUpdating = true;\r
221             Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);\r
222             this.isUpdating = false;\r
223         }\r
224     },\r
225 \r
226     // private\r
227     beforeMenuShow : function(){\r
228         var item, items = this.hmenu.items, disabled = this.cm.config[this.hdCtxIndex].groupable === false;\r
229         if((item = items.get('groupBy'))){\r
230             item.setDisabled(disabled);\r
231         }\r
232         if((item = items.get('showGroups'))){\r
233             item.setDisabled(disabled);\r
234                     item.setChecked(!!this.getGroupField(), true);\r
235         }\r
236     },\r
237 \r
238     // private\r
239     renderUI : function(){\r
240         Ext.grid.GroupingView.superclass.renderUI.call(this);\r
241         this.mainBody.on('mousedown', this.interceptMouse, this);\r
242 \r
243         if(this.enableGroupingMenu && this.hmenu){\r
244             this.hmenu.add('-',{\r
245                 itemId:'groupBy',\r
246                 text: this.groupByText,\r
247                 handler: this.onGroupByClick,\r
248                 scope: this,\r
249                 iconCls:'x-group-by-icon'\r
250             });\r
251             if(this.enableNoGroups){\r
252                 this.hmenu.add({\r
253                     itemId:'showGroups',\r
254                     text: this.showGroupsText,\r
255                     checked: true,\r
256                     checkHandler: this.onShowGroupsClick,\r
257                     scope: this\r
258                 });\r
259             }\r
260             this.hmenu.on('beforeshow', this.beforeMenuShow, this);\r
261         }\r
262     },\r
263 \r
264     // private\r
265     onGroupByClick : function(){\r
266         this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));\r
267         this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups\r
268     },\r
269 \r
270     // private\r
271     onShowGroupsClick : function(mi, checked){\r
272         if(checked){\r
273             this.onGroupByClick();\r
274         }else{\r
275             this.grid.store.clearGrouping();\r
276         }\r
277     },\r
278 \r
279     <div id="method-Ext.grid.GroupingView-toggleGroup"></div>/**\r
280      * Toggles the specified group if no value is passed, otherwise sets the expanded state of the group to the value passed.\r
281      * @param {String} groupId The groupId assigned to the group (see getGroupId)\r
282      * @param {Boolean} expanded (optional)\r
283      */\r
284     toggleGroup : function(group, expanded){\r
285         this.grid.stopEditing(true);\r
286         group = Ext.getDom(group);\r
287         var gel = Ext.fly(group);\r
288         expanded = expanded !== undefined ?\r
289                 expanded : gel.hasClass('x-grid-group-collapsed');\r
290 \r
291         this.state[gel.dom.id] = expanded;\r
292         gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');\r
293     },\r
294 \r
295     <div id="method-Ext.grid.GroupingView-toggleAllGroups"></div>/**\r
296      * Toggles all groups if no value is passed, otherwise sets the expanded state of all groups to the value passed.\r
297      * @param {Boolean} expanded (optional)\r
298      */\r
299     toggleAllGroups : function(expanded){\r
300         var groups = this.getGroups();\r
301         for(var i = 0, len = groups.length; i < len; i++){\r
302             this.toggleGroup(groups[i], expanded);\r
303         }\r
304     },\r
305 \r
306     <div id="method-Ext.grid.GroupingView-expandAllGroups"></div>/**\r
307      * Expands all grouped rows.\r
308      */\r
309     expandAllGroups : function(){\r
310         this.toggleAllGroups(true);\r
311     },\r
312 \r
313     <div id="method-Ext.grid.GroupingView-collapseAllGroups"></div>/**\r
314      * Collapses all grouped rows.\r
315      */\r
316     collapseAllGroups : function(){\r
317         this.toggleAllGroups(false);\r
318     },\r
319 \r
320     // private\r
321     interceptMouse : function(e){\r
322         var hd = e.getTarget('.x-grid-group-hd', this.mainBody);\r
323         if(hd){\r
324             e.stopEvent();\r
325             this.toggleGroup(hd.parentNode);\r
326         }\r
327     },\r
328 \r
329     // private\r
330     getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){\r
331         var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);\r
332         if(g === '' || g === '&#160;'){\r
333             g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;\r
334         }\r
335         return g;\r
336     },\r
337 \r
338     // private\r
339     getGroupField : function(){\r
340         return this.grid.store.getGroupState();\r
341     },\r
342     \r
343     // private\r
344     afterRender : function(){\r
345         Ext.grid.GroupingView.superclass.afterRender.call(this);\r
346         if(this.grid.deferRowRender){\r
347             this.updateGroupWidths();\r
348         }\r
349     },\r
350 \r
351     // private\r
352     renderRows : function(){\r
353         var groupField = this.getGroupField();\r
354         var eg = !!groupField;\r
355         // if they turned off grouping and the last grouped field is hidden\r
356         if(this.hideGroupedColumn) {\r
357             var colIndex = this.cm.findColumnIndex(groupField);\r
358             if(!eg && this.lastGroupField !== undefined) {\r
359                 this.mainBody.update('');\r
360                 this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);\r
361                 delete this.lastGroupField;\r
362             }else if (eg && this.lastGroupField === undefined) {\r
363                 this.lastGroupField = groupField;\r
364                 this.cm.setHidden(colIndex, true);\r
365             }else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {\r
366                 this.mainBody.update('');\r
367                 var oldIndex = this.cm.findColumnIndex(this.lastGroupField);\r
368                 this.cm.setHidden(oldIndex, false);\r
369                 this.lastGroupField = groupField;\r
370                 this.cm.setHidden(colIndex, true);\r
371             }\r
372         }\r
373         return Ext.grid.GroupingView.superclass.renderRows.apply(\r
374                     this, arguments);\r
375     },\r
376 \r
377     // private\r
378     doRender : function(cs, rs, ds, startRow, colCount, stripe){\r
379         if(rs.length < 1){\r
380             return '';\r
381         }\r
382         var groupField = this.getGroupField(),\r
383             colIndex = this.cm.findColumnIndex(groupField),\r
384             g;\r
385 \r
386         this.enableGrouping = !!groupField;\r
387 \r
388         if(!this.enableGrouping || this.isUpdating){\r
389             return Ext.grid.GroupingView.superclass.doRender.apply(\r
390                     this, arguments);\r
391         }\r
392         var gstyle = 'width:' + this.getTotalWidth() + ';',\r
393             gidPrefix = this.grid.getGridEl().id,\r
394             cfg = this.cm.config[colIndex],\r
395             groupRenderer = cfg.groupRenderer || cfg.renderer,\r
396             prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '',\r
397             groups = [],\r
398             curGroup, i, len, gid;\r
399 \r
400         for(i = 0, len = rs.length; i < len; i++){\r
401             var rowIndex = startRow + i,\r
402                 r = rs[i],\r
403                 gvalue = r.data[groupField];\r
404                 \r
405                 g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);\r
406             if(!curGroup || curGroup.group != g){\r
407                 gid = this.constructId(gvalue, gidPrefix, groupField, colIndex);\r
408                 // if state is defined use it, however state is in terms of expanded\r
409                                 // so negate it, otherwise use the default.\r
410                                 var isCollapsed  = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;\r
411                                 var gcls = isCollapsed ? 'x-grid-group-collapsed' : ''; \r
412                 curGroup = {\r
413                     group: g,\r
414                     gvalue: gvalue,\r
415                     text: prefix + g,\r
416                     groupId: gid,\r
417                     startRow: rowIndex,\r
418                     rs: [r],\r
419                     cls: gcls,\r
420                     style: gstyle\r
421                 };\r
422                 groups.push(curGroup);\r
423             }else{\r
424                 curGroup.rs.push(r);\r
425             }\r
426             r._groupId = gid;\r
427         }\r
428 \r
429         var buf = [];\r
430         for(i = 0, len = groups.length; i < len; i++){\r
431             g = groups[i];\r
432             this.doGroupStart(buf, g, cs, ds, colCount);\r
433             buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(\r
434                     this, cs, g.rs, ds, g.startRow, colCount, stripe);\r
435 \r
436             this.doGroupEnd(buf, g, cs, ds, colCount);\r
437         }\r
438         return buf.join('');\r
439     },\r
440 \r
441     <div id="method-Ext.grid.GroupingView-getGroupId"></div>/**\r
442      * Dynamically tries to determine the groupId of a specific value\r
443      * @param {String} value\r
444      * @return {String} The group id\r
445      */\r
446     getGroupId : function(value){\r
447         var field = this.getGroupField();\r
448         return this.constructId(value, this.grid.getGridEl().id, field, this.cm.findColumnIndex(field));\r
449     },\r
450     \r
451     // private\r
452     constructId : function(value, prefix, field, idx){\r
453         var cfg = this.cm.config[idx],\r
454             groupRenderer = cfg.groupRenderer || cfg.renderer,\r
455             val = (this.groupMode == 'value') ? value : this.getGroup(value, {data:{}}, groupRenderer, 0, idx, this.ds);\r
456             \r
457         return prefix + '-gp-' + field + '-' + Ext.util.Format.htmlEncode(val);\r
458     },\r
459 \r
460     // private\r
461     doGroupStart : function(buf, g, cs, ds, colCount){\r
462         buf[buf.length] = this.startGroup.apply(g);\r
463     },\r
464 \r
465     // private\r
466     doGroupEnd : function(buf, g, cs, ds, colCount){\r
467         buf[buf.length] = this.endGroup;\r
468     },\r
469 \r
470     // private\r
471     getRows : function(){\r
472         if(!this.enableGrouping){\r
473             return Ext.grid.GroupingView.superclass.getRows.call(this);\r
474         }\r
475         var r = [];\r
476         var g, gs = this.getGroups();\r
477         for(var i = 0, len = gs.length; i < len; i++){\r
478             g = gs[i].childNodes[1].childNodes;\r
479             for(var j = 0, jlen = g.length; j < jlen; j++){\r
480                 r[r.length] = g[j];\r
481             }\r
482         }\r
483         return r;\r
484     },\r
485 \r
486     // private\r
487     updateGroupWidths : function(){\r
488         if(!this.enableGrouping || !this.hasRows()){\r
489             return;\r
490         }\r
491         var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.getScrollOffset()) +'px';\r
492         var gs = this.getGroups();\r
493         for(var i = 0, len = gs.length; i < len; i++){\r
494             gs[i].firstChild.style.width = tw;\r
495         }\r
496     },\r
497 \r
498     // private\r
499     onColumnWidthUpdated : function(col, w, tw){\r
500         Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, col, w, tw);\r
501         this.updateGroupWidths();\r
502     },\r
503 \r
504     // private\r
505     onAllColumnWidthsUpdated : function(ws, tw){\r
506         Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, ws, tw);\r
507         this.updateGroupWidths();\r
508     },\r
509 \r
510     // private\r
511     onColumnHiddenUpdated : function(col, hidden, tw){\r
512         Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, col, hidden, tw);\r
513         this.updateGroupWidths();\r
514     },\r
515 \r
516     // private\r
517     onLayout : function(){\r
518         this.updateGroupWidths();\r
519     },\r
520 \r
521     // private\r
522     onBeforeRowSelect : function(sm, rowIndex){\r
523         if(!this.enableGrouping){\r
524             return;\r
525         }\r
526         var row = this.getRow(rowIndex);\r
527         if(row && !row.offsetParent){\r
528             var g = this.findGroup(row);\r
529             this.toggleGroup(g, true);\r
530         }\r
531     }\r
532 });\r
533 // private\r
534 Ext.grid.GroupingView.GROUP_ID = 1000;</pre>
535 </body>
536 </html>