File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,23 @@ children of the selected rowHeader.
96
96
});
97
97
}
98
98
});
99
+
100
+ $scope.gridApi.grouping.on.aggregationChanged($scope, function(col){
101
+ if ( col.treeAggregation.type ){
102
+ $scope.lastChange = col.displayName + ' aggregated using ' + col.treeAggregation.type;
103
+ } else {
104
+ $scope.lastChange = 'Aggregation removed from ' + col.displayName;
105
+ }
106
+ });
107
+
108
+ $scope.gridApi.grouping.on.groupingChanged($scope, function(col){
109
+ if ( col.grouping.groupPriority ){
110
+ $scope.lastChange = col.displayName + ' grouped with priority ' + col.grouping.groupPriority;
111
+ } else {
112
+ $scope.lastChange = col.displayName + ' removed from grouped columns';
113
+ }
114
+ });
115
+
99
116
}
100
117
};
101
118
@@ -255,6 +272,7 @@ children of the selected rowHeader.
255
272
256
273
<file name="index.html">
257
274
<div ng-controller="MainCtrl">
275
+ <p ng-show="lastChange">Last grouping change: {{ lastChange }}</p>
258
276
<div id="grid1" ui-grid="gridOptions" ui-grid-grouping ui-grid-edit ui-grid-selection class="grid" style="width:100%;"></div>
259
277
</div>
260
278
</file>
Original file line number Diff line number Diff line change 157
157
var publicApi = {
158
158
events : {
159
159
grouping : {
160
+ /**
161
+ * @ngdoc event
162
+ * @eventOf ui.grid.grouping.api:PublicApi
163
+ * @name aggregationChanged
164
+ * @description raised whenever aggregation is changed, added or removed from a column
165
+ *
166
+ * <pre>
167
+ * gridApi.grouping.on.aggregationChanged(scope,function(col){})
168
+ * </pre>
169
+ * @param {gridCol } col the column which on which aggregation changed. The aggregation
170
+ * type is available as `col.treeAggregation.type`
171
+ */
172
+ aggregationChanged : { } ,
173
+ /**
174
+ * @ngdoc event
175
+ * @eventOf ui.grid.grouping.api:PublicApi
176
+ * @name groupingChanged
177
+ * @description raised whenever the grouped columns changes
178
+ *
179
+ * <pre>
180
+ * gridApi.grouping.on.groupingChanged(scope,function(col){})
181
+ * </pre>
182
+ * @param {gridCol } col the column which on which grouping changed. The new grouping is
183
+ * available as `col.grouping`
184
+ */
185
+ groupingChanged : { }
160
186
}
161
187
} ,
162
188
methods : {
652
678
column . treeAggregationFn = uiGridTreeBaseService . nativeAggregations ( ) [ uiGridGroupingConstants . aggregation . COUNT ] . aggregationFn ;
653
679
column . treeAggregationFinalizerFn = service . groupedFinalizerFn ;
654
680
681
+ grid . api . grouping . raise . groupingChanged ( column ) ;
682
+
655
683
grid . queueGridRefresh ( ) ;
656
684
} ,
657
685
681
709
682
710
service . tidyPriorities ( grid ) ;
683
711
712
+ grid . api . grouping . raise . groupingChanged ( column ) ;
713
+
684
714
grid . queueGridRefresh ( ) ;
685
715
} ,
686
716
712
742
column . treeAggregationFn = aggregationDef . aggregationFn ;
713
743
column . treeAggregationFinalizerFn = aggregationDef . finalizerFn ;
714
744
745
+ grid . api . grouping . raise . aggregationChanged ( column ) ;
746
+
715
747
grid . queueGridRefresh ( ) ;
716
748
} ,
717
749
You can’t perform that action at this time.
0 commit comments