File tree 4 files changed +24
-17
lines changed
4 files changed +24
-17
lines changed Original file line number Diff line number Diff line change 24
24
25
25
containerCtrl . header = $elm ;
26
26
containerCtrl . colContainer . header = $elm ;
27
-
28
- /**
29
- * @ngdoc property
30
- * @name hideHeader
31
- * @propertyOf ui.grid.class:GridOptions
32
- * @description Null by default. When set to true, this setting will replace the
33
- * standard header template with '<div></div>', resulting in no header being shown.
34
- */
35
27
36
28
var headerTemplate ;
37
- if ( $scope . grid . options . hideHeader ) {
29
+ if ( ! $scope . grid . options . showHeader ) {
38
30
headerTemplate = emptyTemplate ;
39
- } else {
31
+ }
32
+ else {
40
33
headerTemplate = ( $scope . grid . options . headerTemplate ) ? $scope . grid . options . headerTemplate : defaultTemplate ;
41
34
}
42
35
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ angular.module('ui.grid').directive('uiGrid',
217
217
if ( grid . gridHeight < grid . options . rowHeight ) {
218
218
// Figure out the new height
219
219
var contentHeight = grid . options . minRowsToShow * grid . options . rowHeight ;
220
- var headerHeight = grid . options . hideHeader ? 0 : grid . options . headerRowHeight ;
220
+ var headerHeight = grid . options . showHeader ? grid . options . headerRowHeight : 0 ;
221
221
var footerHeight = grid . options . showFooter ? grid . options . footerRowHeight : 0 ;
222
222
var scrollbarHeight = grid . options . enableScrollbars ? gridUtil . getScrollbarWidth ( ) : 0 ;
223
223
Original file line number Diff line number Diff line change @@ -128,17 +128,26 @@ angular.module('ui.grid')
128
128
baseOptions . getRowIdentity = baseOptions . getRowIdentity || function getRowIdentity ( row ) {
129
129
return row . $$hashKey ;
130
130
} ;
131
-
131
+
132
+ /**
133
+ * @ngdoc property
134
+ * @name showHeader
135
+ * @propertyOf ui.grid.class:GridOptions
136
+ * @description True by default. When set to false, this setting will replace the
137
+ * standard header template with '<div></div>', resulting in no header being shown.
138
+ *
139
+ * It will also set the `headerRowHeight` option to 0.
140
+ */
141
+ baseOptions . showHeader = typeof ( baseOptions . showHeader ) !== "undefined" ? baseOptions . showHeader : true ;
142
+
132
143
/**
133
144
* @ngdoc property
134
145
* @name headerRowHeight
135
146
* @propertyOf ui.grid.class:GridOptions
136
147
* @description The height of the header in pixels, defaults to 30
137
148
*
138
149
*/
139
- baseOptions . headerRowHeight = typeof ( baseOptions . headerRowHeight ) !== "undefined" ? baseOptions . headerRowHeight : 30 ;
140
-
141
- if ( baseOptions . hideHeader ) {
150
+ if ( ! baseOptions . showHeader ) {
142
151
baseOptions . headerRowHeight = 0 ;
143
152
}
144
153
else {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ describe('GridOptions factory', function () {
23
23
rowHeight : 30 ,
24
24
maxVisibleRowCount : 200 ,
25
25
minRowsToShow : 10 ,
26
+ showHeader : true ,
26
27
showFooter : false ,
27
28
footerRowHeight : 30 ,
28
29
columnWidth : 50 ,
@@ -61,6 +62,7 @@ describe('GridOptions factory', function () {
61
62
rowHeight : 40 ,
62
63
maxVisibleRowCount : 20 ,
63
64
minRowsToShow : 15 ,
65
+ showHeader : true ,
64
66
showFooter : true ,
65
67
footerRowHeight : 50 ,
66
68
columnWidth : 60 ,
@@ -96,6 +98,7 @@ describe('GridOptions factory', function () {
96
98
rowHeight : 40 ,
97
99
maxVisibleRowCount : 20 ,
98
100
minRowsToShow : 15 ,
101
+ showHeader : true ,
99
102
showFooter : true ,
100
103
footerRowHeight : 50 ,
101
104
columnWidth : 60 ,
@@ -135,6 +138,7 @@ describe('GridOptions factory', function () {
135
138
rowHeight : 40 ,
136
139
maxVisibleRowCount : 20 ,
137
140
minRowsToShow : 15 ,
141
+ showHeader : false ,
138
142
showFooter : false ,
139
143
footerRowHeight : 50 ,
140
144
columnWidth : 60 ,
@@ -146,8 +150,8 @@ describe('GridOptions factory', function () {
146
150
excessColumns : 7 ,
147
151
horizontalScrollThreshold : 3 ,
148
152
scrollThrottle : 75 ,
149
- enableSorting : false ,
150
153
enableFiltering : false ,
154
+ enableSorting : false ,
151
155
enableColumnMenus : false ,
152
156
enableVerticalScrollbar : 0 ,
153
157
enableHorizontalScrollbar : 0 ,
@@ -166,10 +170,11 @@ describe('GridOptions factory', function () {
166
170
enableRowHashing : false ,
167
171
rowIdentity : testFunction ,
168
172
getRowIdentity : testFunction ,
169
- headerRowHeight : 40 ,
173
+ headerRowHeight : 0 , // Because of showHeader: false
170
174
rowHeight : 40 ,
171
175
maxVisibleRowCount : 20 ,
172
176
minRowsToShow : 15 ,
177
+ showHeader : false ,
173
178
showFooter : false ,
174
179
footerRowHeight : 50 ,
175
180
columnWidth : 60 ,
You can’t perform that action at this time.
0 commit comments