13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
<!DOCTYPE html>
<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>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='Ext-grid-feature-Grouping'>/**
</span> * This feature allows to display the grid rows aggregated into groups as specified by the {@link Ext.data.Store#groupers}
 * specified on the Store. The group will show the title for the group name and then the appropriate records for the group
 * underneath. The groups can also be expanded and collapsed.
 * 
 * ## Extra Events
 *
 * This feature adds several extra events that will be fired on the grid to interact with the groups:
 *
 *  - {@link #groupclick}
 *  - {@link #groupdblclick}
 *  - {@link #groupcontextmenu}
 *  - {@link #groupexpand}
 *  - {@link #groupcollapse}
 *
 * ## Menu Augmentation
 *
 * This feature adds extra options to the grid column menu to provide the user with functionality to modify the grouping.
 * This can be disabled by setting the {@link #enableGroupingMenu} option. The option to disallow grouping from being turned off
 * by the user is {@link #enableNoGroups}.
 *
 * ## Controlling Group Text
 *
 * The {@link #groupHeaderTpl} is used to control the rendered title for each group. It can modified to customized
 * the default display.
 *
 * ## Example Usage
 *
 *     @example
 *     var store = Ext.create('Ext.data.Store', {
 *         storeId:'employeeStore',
 *         fields:['name', 'seniority', 'department'],
 *         groupField: 'department',
 *         data: {'employees':[
 *             { &quot;name&quot;: &quot;Michael Scott&quot;,  &quot;seniority&quot;: 7, &quot;department&quot;: &quot;Management&quot; },
 *             { &quot;name&quot;: &quot;Dwight Schrute&quot;, &quot;seniority&quot;: 2, &quot;department&quot;: &quot;Sales&quot; },
 *             { &quot;name&quot;: &quot;Jim Halpert&quot;,    &quot;seniority&quot;: 3, &quot;department&quot;: &quot;Sales&quot; },
 *             { &quot;name&quot;: &quot;Kevin Malone&quot;,   &quot;seniority&quot;: 4, &quot;department&quot;: &quot;Accounting&quot; },
 *             { &quot;name&quot;: &quot;Angela Martin&quot;,  &quot;seniority&quot;: 5, &quot;department&quot;: &quot;Accounting&quot; }
 *         ]},
 *         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()
 *     });
 *
 * **Note:** To use grouping with a grid that has {@link Ext.grid.column.Column#locked locked columns}, you need to supply
 * the grouping feature as a config object - so the grid can create two instances of the grouping feature.
 *
 * @author Nigel White
 */
Ext.define('Ext.grid.feature.Grouping', {
    extend: 'Ext.grid.feature.Feature',
    mixins: {
        summary: 'Ext.grid.feature.AbstractSummary'
    },
    requires: ['Ext.grid.feature.GroupStore'],
 
    alias: 'feature.grouping',
 
<span id='Ext-grid-feature-Grouping-property-eventPrefix'>    eventPrefix: 'group',
</span><span id='Ext-grid-feature-Grouping-property-groupCls'>    groupCls: Ext.baseCSSPrefix + 'grid-group-hd',
</span><span id='Ext-grid-feature-Grouping-property-eventSelector'>    eventSelector: '.' + Ext.baseCSSPrefix + 'grid-group-hd',
</span>
<span id='Ext-grid-feature-Grouping-property-refreshData'>    refreshData: {},
</span><span id='Ext-grid-feature-Grouping-property-groupInfo'>    groupInfo: {},
</span><span id='Ext-grid-feature-Grouping-property-wrapsItem'>    wrapsItem: true,
</span>
<span id='Ext-grid-feature-Grouping-event-groupclick'>    /**
</span>     * @event groupclick
     * @param {Ext.view.Table} view
     * @param {HTMLElement} node
     * @param {String} group The name of the group
     * @param {Ext.EventObject} e
     */
 
<span id='Ext-grid-feature-Grouping-event-groupdblclick'>    /**
</span>     * @event groupdblclick
     * @param {Ext.view.Table} view
     * @param {HTMLElement} node
     * @param {String} group The name of the group
     * @param {Ext.EventObject} e
     */
 
<span id='Ext-grid-feature-Grouping-event-groupcontextmenu'>    /**
</span>     * @event groupcontextmenu
     * @param {Ext.view.Table} view
     * @param {HTMLElement} node
     * @param {String} group The name of the group
     * @param {Ext.EventObject} e
     */
 
<span id='Ext-grid-feature-Grouping-event-groupcollapse'>    /**
</span>     * @event groupcollapse
     * @param {Ext.view.Table} view
     * @param {HTMLElement} node
     * @param {String} group The name of the group
     */
 
<span id='Ext-grid-feature-Grouping-event-groupexpand'>    /**
</span>     * @event groupexpand
     * @param {Ext.view.Table} view
     * @param {HTMLElement} node
     * @param {String} group The name of the group
     */
 
<span id='Ext-grid-feature-Grouping-cfg-groupHeaderTpl'>    /**
</span>     * @cfg {String/Array/Ext.Template} groupHeaderTpl
     * A string Template snippet, an array of strings (optionally followed by an object containing Template methods) to be used to construct a Template, or a Template instance.
     * 
     * - Example 1 (Template snippet):
     * 
     *       groupHeaderTpl: 'Group: {name}'
     *     
     * - Example 2 (Array):
     * 
     *       groupHeaderTpl: [
     *           'Group: ',
     *           '&lt;div&gt;{name:this.formatName}&lt;/div&gt;',
     *           {
     *               formatName: function(name) {
     *                   return Ext.String.trim(name);
     *               }
     *           }
     *       ]
     *     
     * - Example 3 (Template Instance):
     * 
     *       groupHeaderTpl: Ext.create('Ext.XTemplate',
     *           'Group: ',
     *           '&lt;div&gt;{name:this.formatName}&lt;/div&gt;',
     *           {
     *               formatName: function(name) {
     *                   return Ext.String.trim(name);
     *               }
     *           }
     *       )
     *
     * @cfg {String}           groupHeaderTpl.groupField         The field name being grouped by.
     * @cfg {String}           groupHeaderTpl.columnName         The column header associated with the field being grouped by *if there is a column for the field*, falls back to the groupField name.
     * @cfg {Mixed}            groupHeaderTpl.groupValue         The value of the {@link Ext.data.Store#groupField groupField} for the group header being rendered.
     * @cfg {String}           groupHeaderTpl.renderedGroupValue The rendered value of the {@link Ext.data.Store#groupField groupField} for the group header being rendered, as produced by the column renderer.
     * @cfg {String}           groupHeaderTpl.name               An alias for renderedGroupValue
     * @cfg {Ext.data.Model[]} groupHeaderTpl.rows               Deprecated - use children instead. An array containing the child records for the group being rendered. *Not available if the store is {@link Ext.data.Store#buffered buffered}*
     * @cfg {Ext.data.Model[]} groupHeaderTpl.children           An array containing the child records for the group being rendered. *Not available if the store is {@link Ext.data.Store#buffered buffered}*
     */
    groupHeaderTpl: '{columnName}: {name}',
 
<span id='Ext-grid-feature-Grouping-cfg-depthToIndent'>    /**
</span>     * @cfg {Number} [depthToIndent=17]
     * Number of pixels to indent per grouping level
     */
    depthToIndent: 17,
 
<span id='Ext-grid-feature-Grouping-property-collapsedCls'>    collapsedCls: Ext.baseCSSPrefix + 'grid-group-collapsed',
</span><span id='Ext-grid-feature-Grouping-property-hdCollapsedCls'>    hdCollapsedCls: Ext.baseCSSPrefix + 'grid-group-hd-collapsed',
</span><span id='Ext-grid-feature-Grouping-property-hdNotCollapsibleCls'>    hdNotCollapsibleCls: Ext.baseCSSPrefix + 'grid-group-hd-not-collapsible',
</span><span id='Ext-grid-feature-Grouping-property-collapsibleCls'>    collapsibleCls: Ext.baseCSSPrefix + 'grid-group-hd-collapsible',
</span><span id='Ext-grid-feature-Grouping-property-ctCls'>    ctCls: Ext.baseCSSPrefix  + 'group-hd-container',
</span>
    //&lt;locale&gt;
<span id='Ext-grid-feature-Grouping-cfg-groupByText'>    /**
</span>     * @cfg {String} [groupByText=&quot;Group by this field&quot;]
     * Text displayed in the grid header menu for grouping by header.
     */
    groupByText : 'Group by this field',
    //&lt;/locale&gt;
    //&lt;locale&gt;
<span id='Ext-grid-feature-Grouping-cfg-showGroupsText'>    /**
</span>     * @cfg {String} [showGroupsText=&quot;Show in groups&quot;]
     * Text displayed in the grid header for enabling/disabling grouping.
     */
    showGroupsText : 'Show in groups',
    //&lt;/locale&gt;
 
<span id='Ext-grid-feature-Grouping-cfg-hideGroupedHeader'>    /**
</span>     * @cfg {Boolean} [hideGroupedHeader=false]
     * True to hide the header that is currently grouped.
     */
    hideGroupedHeader : false,
 
<span id='Ext-grid-feature-Grouping-cfg-startCollapsed'>    /**
</span>     * @cfg {Boolean} [startCollapsed=false]
     * True to start all groups collapsed.
     */
    startCollapsed : false,
 
<span id='Ext-grid-feature-Grouping-cfg-enableGroupingMenu'>    /**
</span>     * @cfg {Boolean} [enableGroupingMenu=true]
     * True to enable the grouping control in the header menu.
     */
    enableGroupingMenu : true,
 
<span id='Ext-grid-feature-Grouping-cfg-enableNoGroups'>    /**
</span>     * @cfg {Boolean} [enableNoGroups=true]
     * True to allow the user to turn off grouping.
     */
    enableNoGroups : true,
 
<span id='Ext-grid-feature-Grouping-cfg-collapsible'>    /**
</span>     * @cfg {Boolean} [collapsible=true]
     * Set to `false` to disable collapsing groups from the UI.
     *
     * This is set to `false` when the associated {@link Ext.data.Store store} is 
     * {@link Ext.data.Store#buffered buffered}.
     */
    collapsible: true,
 
<span id='Ext-grid-feature-Grouping-property-expandTip'>    //&lt;locale&gt;
</span>    expandTip: 'Click to expand. CTRL key collapses all others',
    //&lt;/locale&gt;
 
<span id='Ext-grid-feature-Grouping-property-collapseTip'>    //&lt;locale&gt;
</span>    collapseTip: 'Click to collapse. CTRL/click collapses all others',
<span id='Ext-grid-feature-Grouping-cfg-showSummaryRow'>    //&lt;/locale&gt;
</span>
    showSummaryRow: false,
 
<span id='Ext-grid-feature-Grouping-property-tableTpl'>    tableTpl: {
</span>        before: function(values) {
            // Do not process if we are disabled, and do not process summary records
            if (this.groupingFeature.disabled || values.rows.length === 1 &amp;&amp; values.rows[0].isSummary) {
                return;
            }
            this.groupingFeature.setup(values.rows, values.view.rowValues);
        },
        after: function(values) {
            // Do not process if we are disabled, and do not process summary records
            if (this.groupingFeature.disabled || values.rows.length === 1 &amp;&amp; values.rows[0].isSummary) {
                return;
            }
            this.groupingFeature.cleanup(values.rows, values.view.rowValues);
        },
        priority: 200
    },
 
<span id='Ext-grid-feature-Grouping-property-groupTpl'>    groupTpl: [
</span>        '{%',
            'var me = this.groupingFeature;',
            // If grouping is disabled, do not call setupRowData, and do not wrap
            'if (me.disabled) {',
                'values.needsWrap = false;',
            '} else {',
                'me.setupRowData(values.record, values.recordIndex, values);',
                'values.needsWrap = !me.disabled &amp;&amp; (values.isFirstRow || values.summaryRecord);',
            '}',
        '%}',
        '&lt;tpl if=&quot;needsWrap&quot;&gt;',
            '&lt;tr data-boundView=&quot;{view.id}&quot; data-recordId=&quot;{record.internalId}&quot; data-recordIndex=&quot;{[values.isCollapsedGroup ? -1 : values.recordIndex]}&quot;',
                'class=&quot;{[values.itemClasses.join(&quot; &quot;)]} ' + Ext.baseCSSPrefix + 'grid-wrap-row&lt;tpl if=&quot;!summaryRecord&quot;&gt; ' + Ext.baseCSSPrefix + 'grid-group-row&lt;/tpl&gt;&quot;&gt;',
                '&lt;td class=&quot;' + Ext.baseCSSPrefix + 'group-hd-container&quot; colspan=&quot;{columns.length}&quot;&gt;',
                    '&lt;tpl if=&quot;isFirstRow&quot;&gt;',
                        '{%',
                            // Group title is visible if not locking, or we are the locked side, or the locked side has no columns/
                            // Use visibility to keep row heights synced without intervention.
                            'var groupTitleStyle = (!values.view.lockingPartner || (values.view.ownerCt === values.view.ownerCt.ownerLockable.lockedGrid) || (values.view.lockingPartner.headerCt.getVisibleGridColumns().length === 0)) ? &quot;&quot; : &quot;visibility:hidden&quot;;',
                        '%}',
                        '&lt;div id=&quot;{groupId}&quot; class=&quot;' + Ext.baseCSSPrefix + 'grid-group-hd {collapsibleCls}&quot; tabIndex=&quot;0&quot;&gt;',
                            '&lt;div class=&quot;' + Ext.baseCSSPrefix + 'grid-group-title&quot; style=&quot;{[groupTitleStyle]}&quot;&gt;',
                                '{[values.groupHeaderTpl.apply(values.groupInfo, parent) || &quot;&amp;#160;&quot;]}',
                            '&lt;/div&gt;',
                        '&lt;/div&gt;',
                    '&lt;/tpl&gt;',
 
                    // Only output the child rows if  this is *not* a collapsed group
                    '&lt;tpl if=&quot;summaryRecord || !isCollapsedGroup&quot;&gt;',
                        '&lt;table class=&quot;', Ext.baseCSSPrefix, '{view.id}-table ', Ext.baseCSSPrefix, 'grid-table',
                            '&lt;tpl if=&quot;summaryRecord&quot;&gt; ', Ext.baseCSSPrefix, 'grid-table-summary&lt;/tpl&gt;&quot;',
                            'border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; style=&quot;width:100%&quot;&gt;',
                            '{[values.view.renderColumnSizer(out)]}',
                            // Only output the first row if this is *not* a collapsed group
                            '&lt;tpl if=&quot;!isCollapsedGroup&quot;&gt;',
                                '{%',
                                    'values.itemClasses.length = 0;',
                                    'this.nextTpl.applyOut(values, out, parent);',
                                '%}',
                            '&lt;/tpl&gt;',
                            '&lt;tpl if=&quot;summaryRecord&quot;&gt;',
                                '{%me.outputSummaryRecord(values.summaryRecord, values, out);%}',
                            '&lt;/tpl&gt;',
                        '&lt;/table&gt;',
                    '&lt;/tpl&gt;',
                '&lt;/td&gt;',
            '&lt;/tr&gt;',
        '&lt;tpl else&gt;',
            '{%this.nextTpl.applyOut(values, out, parent);%}',
        '&lt;/tpl&gt;', {
            priority: 200,
 
            syncRowHeights: function(firstRow, secondRow) {
                firstRow = Ext.fly(firstRow, 'syncDest');
                secondRow = Ext.fly(secondRow, 'sycSrc');
                var owner = this.owner,
                    firstHd = firstRow.down(owner.eventSelector, true),
                    secondHd,
                    firstSummaryRow = firstRow.down(owner.summaryRowSelector, true),
                    secondSummaryRow,
                    firstHeight, secondHeight;
 
                // Sync the heights of header elements in each row if they need it.
                if (firstHd &amp;&amp; (secondHd = secondRow.down(owner.eventSelector, true))) {
                    firstHd.style.height = secondHd.style.height = '';
                    if ((firstHeight = firstHd.offsetHeight) &gt; (secondHeight = secondHd.offsetHeight)) {
                        Ext.fly(secondHd).setHeight(firstHeight);
                    }
                    else if (secondHeight &gt; firstHeight) {
                        Ext.fly(firstHd).setHeight(secondHeight);
                    }
                }
 
                // Sync the heights of summary row in each row if they need it.
                if (firstSummaryRow &amp;&amp; (secondSummaryRow = secondRow.down(owner.summaryRowSelector, true))) {
                    firstSummaryRow.style.height = secondSummaryRow.style.height = '';
                    if ((firstHeight = firstSummaryRow.offsetHeight) &gt; (secondHeight = secondSummaryRow.offsetHeight)) {
                        Ext.fly(secondSummaryRow).setHeight(firstHeight);
                    }
                    else if (secondHeight &gt; firstHeight) {
                        Ext.fly(firstSummaryRow).setHeight(secondHeight);
                    }
                }
            },
 
            syncContent: function(destRow, sourceRow) {
                destRow = Ext.fly(destRow, 'syncDest');
                sourceRow = Ext.fly(sourceRow, 'sycSrc');
                var owner = this.owner,
                    destHd = destRow.down(owner.eventSelector, true),
                    sourceHd = sourceRow.down(owner.eventSelector, true),
                    destSummaryRow = destRow.down(owner.summaryRowSelector, true),
                    sourceSummaryRow = sourceRow.down(owner.summaryRowSelector, true);
 
                // Sync the content of header element.
                if (destHd &amp;&amp; sourceHd) {
                    Ext.fly(destHd).syncContent(sourceHd);
                }
 
                // Sync the content of summary row element.
                if (destSummaryRow &amp;&amp; sourceSummaryRow) {
                    Ext.fly(destSummaryRow).syncContent(sourceSummaryRow);
                }
            }
        }
    ],
 
<span id='Ext-grid-feature-Grouping-method-constructor'>    constructor: function() {
</span>        this.groupCache = {};
        this.callParent(arguments);
    },
 
<span id='Ext-grid-feature-Grouping-method-init'>    init: function(grid) {
</span>        var me = this,
            view = me.view;
 
        view.isGrouping = true;
 
        // The expensively maintained groupCache is shared between twinned Grouping features.
        if (me.lockingPartner &amp;&amp; me.lockingPartner.groupCache) {
            me.groupCache = me.lockingPartner.groupCache;
        }
 
        me.mixins.summary.init.call(me);
 
        me.callParent(arguments);
        view.headerCt.on({
            columnhide: me.onColumnHideShow,
            columnshow: me.onColumnHideShow,
            columnmove: me.onColumnMove,
            scope: me
        });
 
        // Add a table level processor
        view.addTableTpl(me.tableTpl).groupingFeature = me;
 
        // Add a row level processor
        view.addRowTpl(Ext.XTemplate.getTpl(me, 'groupTpl')).groupingFeature = me;
 
        view.preserveScrollOnRefresh = true;
 
        // Sparse store - we can never collapse groups
        if (view.store.buffered) {
            me.collapsible = false;
        }
        // If it's a local store we can build a grouped store for use as the view's dataSource
        else {
 
            // Share the GroupStore between both sides of a locked grid
            if (this.lockingPartner &amp;&amp; this.lockingPartner.dataSource) {
                me.dataSource = view.dataSource = this.lockingPartner.dataSource;
            } else {
                me.dataSource = view.dataSource = new Ext.grid.feature.GroupStore(me, view.store);
            }
        }
 
        me.grid.on({
            reconfigure: me.onReconfigure
        });
        view.on({
            afterrender: me.afterViewRender,
            scope: me,
            single: true
        });
    },
 
<span id='Ext-grid-feature-Grouping-method-clearGroupCache'>    clearGroupCache: function() {
</span>        var me = this,
            groupCache = me.groupCache = {};
 
        if (me.lockingPartner) {
            me.lockingPartner.groupCache = groupCache;
        }
        return groupCache;
    },
 
<span id='Ext-grid-feature-Grouping-method-vetoEvent'>    vetoEvent: function(record, row, rowIndex, e) {
</span>        // Do not veto mouseover/mouseout
        if (e.type !== 'mouseover' &amp;&amp; e.type !== 'mouseout'  &amp;&amp; e.type !== 'mouseenter' &amp;&amp; e.type !== 'mouseleave' &amp;&amp; e.getTarget(this.eventSelector)) {
            return false;
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-enable'>    enable: function() {
</span>        var me    = this,
            view  = me.view,
            store = view.store,
            groupToggleMenuItem;
 
        me.lastGroupField = me.getGroupField();
 
        view.isGrouping = true;
        if (me.lastGroupIndex) {
            me.block();
            store.group(me.lastGroupIndex);
            me.unblock();
        }
        me.callParent();
        groupToggleMenuItem = me.view.headerCt.getMenu().down('#groupToggleMenuItem');
        if (groupToggleMenuItem) {
            groupToggleMenuItem.setChecked(true, true);
        }
        me.refreshIf();
    },
 
<span id='Ext-grid-feature-Grouping-method-disable'>    disable: function() {
</span>        var me    = this,
            view  = me.view,
            store = view.store,
            groupToggleMenuItem,
            lastGroup;
 
        view.isGrouping = false;
        lastGroup = store.groupers.first();
        if (lastGroup) {
            me.lastGroupIndex = lastGroup.property;
            me.block();
            store.clearGrouping();
            me.unblock();
        }
 
        me.callParent();
        groupToggleMenuItem = me.view.headerCt.getMenu().down('#groupToggleMenuItem');
        if (groupToggleMenuItem) {
            groupToggleMenuItem.setChecked(false, true);
        }
        me.refreshIf();
    },
 
<span id='Ext-grid-feature-Grouping-method-refreshIf'>    refreshIf: function() {
</span>        var ownerCt = this.grid.ownerCt,
            view = this.view;
 
        if (!view.store.remoteGroup &amp;&amp; !this.blockRefresh) {
 
            // We are one side of a lockable grid, so refresh the locking view
            if (ownerCt &amp;&amp; ownerCt.lockable) {
                ownerCt.view.refresh();
            } else {
                view.refresh();
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-afterViewRender'>    // Attach events to view
</span>    afterViewRender: function() {
        var me = this,
            view = me.view;
 
        view.on({
            scope: me,
            groupclick: me.onGroupClick
        });
 
        if (me.enableGroupingMenu) {
            me.injectGroupingMenu();
        }
 
        me.pruneGroupedHeader();
 
        me.lastGroupField = me.getGroupField();
        me.block();
        me.onGroupChange();
        me.unblock();
    },
 
<span id='Ext-grid-feature-Grouping-method-injectGroupingMenu'>    injectGroupingMenu: function() {
</span>        var me       = this,
            headerCt = me.view.headerCt;
 
        headerCt.showMenuBy = me.showMenuBy;
        headerCt.getMenuItems = me.getMenuItems();
    },
 
<span id='Ext-grid-feature-Grouping-method-onColumnHideShow'>    onColumnHideShow: function(headerOwnerCt, header) {
</span>        var view = this.view,
            headerCt = view.headerCt,
            menu = headerCt.getMenu(),
            groupToggleMenuItem  = menu.down('#groupMenuItem'),
            colCount = headerCt.getGridColumns().length,
            items,
            len,
            i;
 
        // &quot;Group by this field&quot; must be disabled if there's only one column left visible.
        if (groupToggleMenuItem) {
            if (headerCt.getVisibleGridColumns().length &gt; 1) {
                groupToggleMenuItem.enable();
            } else {
                groupToggleMenuItem.disable();
            }
        }
 
        // header containing TDs have to span all columns, hiddens are just zero width
        if (view.rendered) {
            items = view.el.query('.' + this.ctCls);
            for (i = 0, len = items.length; i &lt; len; ++i) {
                items[i].colSpan = colCount;
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-onColumnMove'>    // Update first and last records in groups when column moves
</span>    // Because of the RowWrap template, this will update the groups' headers and footers
    onColumnMove: function() {
        var me = this,
            store = me.view.store,
            groups,
            i, len,
            groupInfo, firstRec, lastRec;
 
        if (store.isGrouped()) {
            groups = store.getGroups();
            len = groups.length;
 
            // Iterate through groups, firing updates on boundary records
            for (i = 0; i &lt; len; i++) {
                groupInfo = groups[i];
                firstRec = groupInfo.children[0];
                lastRec = groupInfo.children[groupInfo.children.length - 1];
 
                // Must pass the modifiedFields parameter as null so that the
                // listener options does not take that place in the arguments list
                store.fireEvent('update', store, firstRec, 'edit', null);
                if (lastRec !== firstRec) {
                    store.fireEvent('update', store, lastRec, 'edit', null);
                }
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-showMenuBy'>    showMenuBy: function(t, header) {
</span>        var menu = this.getMenu(),
            groupMenuItem  = menu.down('#groupMenuItem'),
            groupMenuMeth = header.groupable === false || this.view.headerCt.getVisibleGridColumns().length &lt; 2 ?  'disable' : 'enable',
            groupToggleMenuItem  = menu.down('#groupToggleMenuItem'),
            isGrouped = this.view.store.isGrouped();
 
        groupMenuItem[groupMenuMeth]();
        if (groupToggleMenuItem) {
            groupToggleMenuItem.setChecked(isGrouped, true);
            groupToggleMenuItem[isGrouped ?  'enable' : 'disable']();
        }
        Ext.grid.header.Container.prototype.showMenuBy.apply(this, arguments);
    },
 
<span id='Ext-grid-feature-Grouping-method-getMenuItems'>    getMenuItems: function() {
</span>        var me                 = this,
            groupByText        = me.groupByText,
            disabled           = me.disabled || !me.getGroupField(),
            showGroupsText     = me.showGroupsText,
            enableNoGroups     = me.enableNoGroups,
            getMenuItems       = me.view.headerCt.getMenuItems;
 
        // runs in the scope of headerCt
        return function() {
 
            // We cannot use the method from HeaderContainer's prototype here
            // because other plugins or features may already have injected an implementation
            var o = getMenuItems.call(this);
            o.push('-', {
                iconCls: Ext.baseCSSPrefix + 'group-by-icon',
                itemId: 'groupMenuItem',
                text: groupByText,
                handler: me.onGroupMenuItemClick,
                scope: me
            });
            if (enableNoGroups) {
                o.push({
                    itemId: 'groupToggleMenuItem',
                    text: showGroupsText,
                    checked: !disabled,
                    checkHandler: me.onGroupToggleMenuItemClick,
                    scope: me
                });
            }
            return o;
        };
    },
 
<span id='Ext-grid-feature-Grouping-method-onGroupMenuItemClick'>    /**
</span>     * Group by the header the user has clicked on.
     * @private
     */
    onGroupMenuItemClick: function(menuItem, e) {
        var me = this,
            menu = menuItem.parentMenu,
            hdr  = menu.activeHeader,
            view = me.view,
            store = view.store;
 
        me.lastGroupIndex = null;
        me.block();
        me.enable();
        store.group(hdr.dataIndex);
        me.pruneGroupedHeader();
        me.unblock();
        me.refreshIf();
    },
 
<span id='Ext-grid-feature-Grouping-method-block'>    block: function(fromPartner) {
</span>        this.blockRefresh = this.view.blockRefresh = true;
        if (this.lockingPartner &amp;&amp; !fromPartner) {
            this.lockingPartner.block(true);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-unblock'>    unblock: function(fromPartner) {
</span>        this.blockRefresh = this.view.blockRefresh = false;
        if (this.lockingPartner &amp;&amp; !fromPartner) {
            this.lockingPartner.unblock(true);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-onGroupToggleMenuItemClick'>    /**
</span>     * Turn on and off grouping via the menu
     * @private
     */
    onGroupToggleMenuItemClick: function(menuItem, checked) {
        this[checked ? 'enable' : 'disable']();
    },
 
<span id='Ext-grid-feature-Grouping-method-pruneGroupedHeader'>    /**
</span>     * Prunes the grouped header from the header container
     * @private
     */
    pruneGroupedHeader: function() {
        var me = this,
            header = me.getGroupedHeader();
 
        if (me.hideGroupedHeader &amp;&amp; header) {
            Ext.suspendLayouts();
            if (me.prunedHeader &amp;&amp; me.prunedHeader !== header) {
                me.prunedHeader.show();
            }
            me.prunedHeader = header;
            header.hide();
            Ext.resumeLayouts(true);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-getHeaderNode'>    getHeaderNode: function(groupName) {
</span>        return Ext.get(this.createGroupId(groupName));
    },
 
<span id='Ext-grid-feature-Grouping-method-getGroup'>    getGroup: function(name) {
</span>        var cache = this.groupCache,
            item = cache[name];
 
        if (!item) {
            item = cache[name] = {
                isCollapsed: false
            };
        }    
        return item;
    },
 
<span id='Ext-grid-feature-Grouping-method-isExpanded'>    /**
</span>     * Returns `true` if the named group is expanded.
     * @param {String} groupName The group name as returned from {@link Ext.data.Store#getGroupString getGroupString}. This is usually the value of
     * the {@link Ext.data.Store#groupField groupField}.
     * @return {Boolean} `true` if the group defined by that value is expanded.
     */
    isExpanded: function(groupName) {
        return !this.getGroup(groupName).isCollapsed;
    },
 
<span id='Ext-grid-feature-Grouping-method-expand'>    /**
</span>     * Expand a group
     * @param {String} groupName The group name
     * @param {Boolean} focus Pass `true` to focus the group after expand.
     */
    expand: function(groupName, focus) {
        this.doCollapseExpand(false, groupName, focus);
    },
 
<span id='Ext-grid-feature-Grouping-method-expandAll'>    /**
</span>     * Expand all groups
     */
    expandAll: function() {
        var me = this,
            view = me.view,
            groupCache = me.groupCache,
            groupName,
            lockingPartner = me.lockingPartner,
            partnerView;
 
        // Clear all collapsed flags.
        // groupCache is shared between two lockingPartners
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                groupCache[groupName].isCollapsed = false;
            }
        }
        Ext.suspendLayouts();
        view.suspendEvent('beforerefresh', 'refresh');
        if (lockingPartner) {
            partnerView = lockingPartner.view
            partnerView.suspendEvent('beforerefresh', 'refresh');
        }
        me.dataSource.onRefresh();
        view.resumeEvent('beforerefresh', 'refresh');
        if (lockingPartner) {
            partnerView.resumeEvent('beforerefresh', 'refresh');
        }
        Ext.resumeLayouts(true);
 
        // Fire event for all groups post expand
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                me.afterCollapseExpand(false, groupName);
                if (lockingPartner) {
                    lockingPartner.afterCollapseExpand(false, groupName);
                }
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-collapse'>    /**
</span>     * Collapse a group
     * @param {String} groupName The group name
     * @param {Boolean} focus Pass `true` to focus the group after expand.
     */
    collapse: function(groupName, focus) {
        this.doCollapseExpand(true, groupName, focus);
    },
 
<span id='Ext-grid-feature-Grouping-method-isAllCollapsed'>    // private
</span>    // Returns true if all groups are collapsed
    isAllCollapsed: function() {
        var me = this,
            groupCache = me.groupCache,
            groupName;
 
        // Clear all collapsed flags.
        // groupCache is shared between two lockingPartners
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                if (!groupCache[groupName].isCollapsed) {
                    return false;
                }
            }
        }
        return true;
    },
 
<span id='Ext-grid-feature-Grouping-method-isAllExpanded'>    // private
</span>    // Returns true if all groups are expanded
    isAllExpanded: function() {
        var me = this,
            groupCache = me.groupCache,
            groupName;
 
        // Clear all collapsed flags.
        // groupCache is shared between two lockingPartners
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                if (groupCache[groupName].isCollapsed) {
                    return false;
                }
            }
        }
        return true;
    },
 
<span id='Ext-grid-feature-Grouping-method-collapseAll'>    /**
</span>     * Collapse all groups
     */
    collapseAll: function() {
        var me = this,
            view = me.view,
            groupCache = me.groupCache,
            groupName,
            lockingPartner = me.lockingPartner,
            partnerView;
 
        // Set all collapsed flags
        // groupCache is shared between two lockingPartners
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                groupCache[groupName].isCollapsed = true;
            }
        }
        Ext.suspendLayouts();
        view.suspendEvent('beforerefresh', 'refresh');
        if (lockingPartner) {
            partnerView = lockingPartner.view
            partnerView.suspendEvent('beforerefresh', 'refresh');
        }
        me.dataSource.onRefresh();
        view.resumeEvent('beforerefresh', 'refresh');
        if (lockingPartner) {
            partnerView.resumeEvent('beforerefresh', 'refresh');
        }
 
        if (lockingPartner &amp;&amp; !lockingPartner.isAllCollapsed()) {
            lockingPartner.collapseAll();
        }
        Ext.resumeLayouts(true);
 
        // Fire event for all groups post collapse
        for (groupName in groupCache) {
            if (groupCache.hasOwnProperty(groupName)) {
                me.afterCollapseExpand(true, groupName);
                if (lockingPartner) {
                    lockingPartner.afterCollapseExpand(true, groupName);
                }
            }
        }
 
    },
 
<span id='Ext-grid-feature-Grouping-method-doCollapseExpand'>    doCollapseExpand: function(collapsed, groupName, focus) {
</span>        var me = this,
            lockingPartner = me.lockingPartner,
            group = me.groupCache[groupName];
 
        // groupCache is shared between two lockingPartners
        if (group.isCollapsed != collapsed) {
 
            // The GroupStore is shared by partnered Grouping features, so this will refresh both sides.
            // We only want one layout as a result though, so suspend layouts while refreshing.
            Ext.suspendLayouts();
            if (collapsed) {
                me.dataSource.collapseGroup(group);
            } else {
                me.dataSource.expandGroup(group);
            }
            Ext.resumeLayouts(true);
 
            // Sync the group state and focus the row if requested.
            me.afterCollapseExpand(collapsed, groupName, focus);
 
            // Sync the lockingPartner's group state.
            // Do not pass on focus flag. If we were told to focus, we must focus, not the other side.
            if (lockingPartner) {
                lockingPartner.afterCollapseExpand(collapsed, groupName, false);
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-afterCollapseExpand'>    afterCollapseExpand: function(collapsed, groupName, focus) {
</span>        var me = this,
            view = me.view,
            header;
 
        header = Ext.get(this.getHeaderNode(groupName));
        view.fireEvent(collapsed ? 'groupcollapse' : 'groupexpand', view, header, groupName);
        if (focus) {
            header.up(view.getItemSelector()).scrollIntoView(view.el, null, true);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-onGroupChange'>    onGroupChange: function() {
</span>        var me = this,
            field = me.getGroupField(),
            menuItem,
            visibleGridColumns,
            groupingByLastVisibleColumn;
 
        if (me.hideGroupedHeader) {
            if (me.lastGroupField) {
                menuItem = me.getMenuItem(me.lastGroupField);
                if (menuItem) {
                    menuItem.setChecked(true);
                }
            }
            if (field) {
                visibleGridColumns = me.view.headerCt.getVisibleGridColumns();
 
                // See if we are being asked to group by the sole remaining visible column.
                // If so, then do not hide that column.
                groupingByLastVisibleColumn = ((visibleGridColumns.length === 1) &amp;&amp; (visibleGridColumns[0].dataIndex == field));
                menuItem = me.getMenuItem(field);
                if (menuItem &amp;&amp; !groupingByLastVisibleColumn) {
                    menuItem.setChecked(false);
                }
            }
        }
        me.refreshIf();
        me.lastGroupField = field;
    },
 
<span id='Ext-grid-feature-Grouping-method-getMenuItem'>    /**
</span>     * Gets the related menu item for a dataIndex
     * @private
     * @return {Ext.grid.header.Container} The header
     */
    getMenuItem: function(dataIndex){
        var view = this.view,
            header = view.headerCt.down('gridcolumn[dataIndex=' + dataIndex + ']'),
            menu = view.headerCt.getMenu();
 
        return header ? menu.down('menuitem[headerId='+ header.id +']') : null;
    },
 
<span id='Ext-grid-feature-Grouping-method-onGroupKey'>    onGroupKey: function(keyCode, event) {
</span>        var me = this,
            groupName = me.getGroupName(event.target);
 
        if (groupName) {
            me.onGroupClick(me.view, event.target, groupName, event);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-onGroupClick'>    /**
</span>     * Toggle between expanded/collapsed state when clicking on
     * the group.
     * @private
     */
    onGroupClick: function(view, rowElement, groupName, e) {
        var me = this,
            groupCache = me.groupCache,
            groupIsCollapsed = !me.isExpanded(groupName),
            g;
 
        if (me.collapsible) {
 
            // CTRL means collapse all others
            if (e.ctrlKey) {
                Ext.suspendLayouts();
                for (g in groupCache) {
                    if (g === groupName) {
                        if (groupIsCollapsed) {
                            me.expand(groupName);
                        }
                    } else {
                        me.doCollapseExpand(true, g, false);
                    }
                }
                Ext.resumeLayouts(true);
                return;
            }
 
            if (groupIsCollapsed) {
               me.expand(groupName);
            } else {
                me.collapse(groupName);
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-setupRowData'>    setupRowData: function(record, idx, rowValues) {
</span>        var me = this,
            data = me.refreshData,
            groupInfo = me.groupInfo,
            header = data.header,
            groupField = data.groupField,
            store = me.view.dataSource,
            grouper, groupName, prev, next;
 
        rowValues.isCollapsedGroup = false;
        rowValues.summaryRecord = null;
 
        if (data.doGrouping) {
            grouper = me.view.store.groupers.first();
 
            // This is a placeholder record which represents a whole collapsed group
            // It is a special case.
            if (record.children) {
                groupName = grouper.getGroupString(record.children[0]);
 
                rowValues.isFirstRow = rowValues.isLastRow = true;
                rowValues.itemClasses.push(me.hdCollapsedCls);
                rowValues.isCollapsedGroup = true;
                rowValues.groupInfo = groupInfo;
                groupInfo.groupField = groupField;
                groupInfo.name = groupName;
                groupInfo.groupValue = record.children[0].get(groupField);
                groupInfo.columnName = header ? header.text : groupField;
                rowValues.collapsibleCls = me.collapsible ? me.collapsibleCls : me.hdNotCollapsibleCls;
                rowValues.groupId = me.createGroupId(groupName);
                groupInfo.rows = groupInfo.children = record.children;
                if (me.showSummaryRow) {
                    rowValues.summaryRecord = data.summaryData[groupName];
                }
                return;
            }
 
            groupName = grouper.getGroupString(record);
 
            // See if the current record is the last in the group
            rowValues.isFirstRow = idx === 0;
            if (!rowValues.isFirstRow) {
                prev = store.getAt(idx - 1);
                // If the previous row is of a different group, then we're at the first for a new group
                if (prev) {
                    // Must use Model's comparison because Date objects are never equal
                    rowValues.isFirstRow = !prev.isEqual(grouper.getGroupString(prev), groupName);
                }
            }
 
            // See if the current record is the last in the group
            rowValues.isLastRow = idx == store.getTotalCount() - 1;
            if (!rowValues.isLastRow) {
                next = store.getAt(idx + 1);
                if (next) {
                    // Must use Model's comparison because Date objects are never equal
                    rowValues.isLastRow = !next.isEqual(grouper.getGroupString(next), groupName);
                }
            }
 
            if (rowValues.isFirstRow) {
                groupInfo.groupField = groupField;
                groupInfo.name = groupName;
                groupInfo.groupValue = record.get(groupField);
                groupInfo.columnName = header ? header.text : groupField;
                rowValues.collapsibleCls = me.collapsible ? me.collapsibleCls : me.hdNotCollapsibleCls;
                rowValues.groupId = me.createGroupId(groupName);
 
                if (!me.isExpanded(groupName)) {
                    rowValues.itemClasses.push(me.hdCollapsedCls);
                    rowValues.isCollapsedGroup = true;
                }
 
                // We only get passed a GroupStore if the store is not buffered
                if (store.buffered) {
                    groupInfo.rows = groupInfo.children = [];
                } else {
                    groupInfo.rows = groupInfo.children = me.getRecordGroup(record).children;
                }
                rowValues.groupInfo = groupInfo;
            }
 
            if (rowValues.isLastRow) {
                // Add the group's summary record to the last record in the group
                if (me.showSummaryRow) {
                    rowValues.summaryRecord = data.summaryData[groupName];
                }
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-setup'>    setup: function(rows, rowValues) {
</span>        var me = this,
            data = me.refreshData,
            isGrouping = !me.disabled &amp;&amp; me.view.store.isGrouped();
            
        me.skippedRows = 0;
        if (rowValues.view.bufferedRenderer) {
            rowValues.view.bufferedRenderer.variableRowHeight = true;
        }
        data.groupField = me.getGroupField();
        data.header = me.getGroupedHeader(data.groupField);
        data.doGrouping = isGrouping;
        rowValues.groupHeaderTpl = Ext.XTemplate.getTpl(me, 'groupHeaderTpl');
 
        if (isGrouping &amp;&amp; me.showSummaryRow) {
            data.summaryData = me.generateSummaryData();
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-cleanup'>    cleanup: function(rows, rowValues) {
</span>        var data = this.refreshData;
 
        rowValues.groupInfo = rowValues.groupHeaderTpl = rowValues.isFirstRow = null;
        data.groupField = data.header = null;
    },
 
<span id='Ext-grid-feature-Grouping-method-getGroupName'>    getGroupName: function(element) {
</span>        var me = this,
            view = me.view,
            eventSelector = me.eventSelector,
            parts,
            targetEl,
            row;
 
        // See if element is, or is within a group header. If so, we can extract its name
        targetEl = Ext.fly(element).findParent(eventSelector);
 
        if (!targetEl) {
            // Otherwise, navigate up to the row and look down to see if we can find it    
            row = Ext.fly(element).findParent(view.itemSelector);
            if (row) {
                targetEl = row.down(eventSelector, true);
            }
        }
 
        if (targetEl) {
            parts = targetEl.id.split(view.id + '-hd-');
            if (parts.length === 2) {
                return Ext.htmlDecode(parts[1]);
            }
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-getRecordGroup'>    /**
</span>     * Returns the group data object for the group to which the passed record belongs **if the Store is grouped**.
     *
     * @param {Ext.data.Model} record The record for which to return group information.
     * @return {Object} A single group data block as returned from {@link Ext.data.Store#getGroups Store.getGroups}. Returns
     * `undefined` if the Store is not grouped.
     *
     */
    getRecordGroup: function(record) {
        var grouper = this.view.store.groupers.first();
        if (grouper) {
            return this.groupCache[grouper.getGroupString(record)];
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-createGroupId'>    createGroupId: function(group) {
</span>        return this.view.id + '-hd-' + Ext.htmlEncode(group);
    },
 
<span id='Ext-grid-feature-Grouping-method-createGroupCls'>    createGroupCls: function(group) {
</span>        return this.view.id + '-' + Ext.htmlEncode(group) + '-item';    
    },
 
<span id='Ext-grid-feature-Grouping-method-getGroupField'>    getGroupField: function(){
</span>        return this.view.store.getGroupField();
    },
 
<span id='Ext-grid-feature-Grouping-method-getGroupedHeader'>    getGroupedHeader: function(groupField) {
</span>        var me = this,
            headerCt = me.view.headerCt,
            partner = me.lockingPartner,
            selector, header;
 
        groupField = groupField || this.getGroupField();
 
        if (groupField) {
            selector = '[dataIndex=' + groupField + ']';
            header = headerCt.down(selector);
            // The header may exist in the locking partner, so check there as well
            if (!header &amp;&amp; partner) {
                header = partner.view.headerCt.down(selector);
            }
        }
        return header || null;
    },
 
<span id='Ext-grid-feature-Grouping-method-getFireEventArgs'>    getFireEventArgs: function(type, view, targetEl, e) {
</span>        return [type, view, targetEl, this.getGroupName(targetEl), e];
    },
 
<span id='Ext-grid-feature-Grouping-method-destroy'>    destroy: function(){
</span>        var me = this,
            dataSource = me.dataSource;
 
        me.view = me.prunedHeader = me.grid = me.groupCache = me.dataSource = null;
        me.callParent();
        if (dataSource) {
            dataSource.bindStore(null);
        }
    },
 
<span id='Ext-grid-feature-Grouping-method-onReconfigure'>    onReconfigure: function(grid, store, columns, oldStore, oldColumns) {
</span>        var me = grid;
 
        if (store &amp;&amp; store !== oldStore) {
            // Grouping involves injecting a dataSource in early
            if (store.buffered !== oldStore.buffered) {
                Ext.Error.raise('Cannot reconfigure grouping switching between buffered and non-buffered stores');
            }
            if (store.buffered) {
                me.bindStore(store);
                me.dataSource.processStore(store);
            }
        }
    }
});</pre>
</body>
</html>