File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,17 @@ You can override the default grid footer template with gridOptions.footerTemplat
52
52
onRegisterApi: function(gridApi) {
53
53
$scope.gridApi = gridApi;
54
54
}
55
- }
55
+ };
56
+
57
+ $scope.toggleFooter = function() {
58
+ $scope.gridOptions.showGridFooter = !$scope.gridOptions.showGridFooter;
59
+ $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);
60
+ };
61
+
62
+ $scope.toggleColumnFooter = function() {
63
+ $scope.gridOptions.showColumnFooter = !$scope.gridOptions.showColumnFooter;
64
+ $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);
65
+ };
56
66
57
67
$http.get('/data/500_complex.json')
58
68
.success(function(data) {
@@ -65,8 +75,8 @@ You can override the default grid footer template with gridOptions.footerTemplat
65
75
</file>
66
76
<file name="index.html">
67
77
<div ng-controller="MainCtrl">
68
- <button id="footerButton" class="btn btn-success" ng-click="gridOptions.showGridFooter = !gridOptions.showGridFooter; $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS); ">Toggle Grid Footer</button>
69
- <button class="btn btn-success" ng-click="gridOptions.showColumnFooter = !gridOptions.showColumnFooter; $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS); ">Toggle Column Footer</button>
78
+ <button id="footerButton" class="btn btn-success" ng-click="toggleFooter() ">Toggle Grid Footer</button>
79
+ <button class="btn btn-success" ng-click="toggleColumnFooter() ">Toggle Column Footer</button>
70
80
<div id="grid1" ui-grid="gridOptions" class="grid"></div>
71
81
</div>
72
82
</file>
Original file line number Diff line number Diff line change @@ -433,6 +433,7 @@ angular.module('ui.grid')
433
433
434
434
self . registerDataChangeCallback ( self . columnRefreshCallback , [ uiGridConstants . dataChange . COLUMN ] ) ;
435
435
self . registerDataChangeCallback ( self . processRowsCallback , [ uiGridConstants . dataChange . EDIT ] ) ;
436
+ self . registerDataChangeCallback ( self . updateFooterHeightCallback , [ uiGridConstants . dataChange . OPTIONS ] ) ;
436
437
437
438
self . registerStyleComputation ( {
438
439
priority : 10 ,
@@ -645,6 +646,20 @@ angular.module('ui.grid')
645
646
} ;
646
647
647
648
649
+ /**
650
+ * @ngdoc function
651
+ * @name updateFooterHeightCallback
652
+ * @methodOf ui.grid.class:Grid
653
+ * @description recalculates the footer height,
654
+ * registered as a dataChangeCallback on uiGridConstants.dataChange.OPTIONS
655
+ * @param {string } name column name
656
+ */
657
+ Grid . prototype . updateFooterHeightCallback = function updateFooterHeightCallback ( grid ) {
658
+ grid . footerHeight = grid . calcFooterHeight ( ) ;
659
+ grid . columnFooterHeight = grid . calcColumnFooterHeight ( ) ;
660
+ } ;
661
+
662
+
648
663
/**
649
664
* @ngdoc function
650
665
* @name getColumn
You can’t perform that action at this time.
0 commit comments