@@ -2065,8 +2065,8 @@ angular.module('ui.grid')
2065
2065
}
2066
2066
2067
2067
if ( container . header || container . headerCanvas ) {
2068
- container . explicitHeaderHeight = null ;
2069
- container . explicitHeaderCanvasHeight = null ;
2068
+ container . explicitHeaderHeight = container . explicitHeaderHeight || null ;
2069
+ container . explicitHeaderCanvasHeight = container . explicitHeaderCanvasHeight || null ;
2070
2070
2071
2071
containerHeadersToRecalc . push ( container ) ;
2072
2072
}
@@ -2102,6 +2102,12 @@ angular.module('ui.grid')
2102
2102
var maxHeaderHeight = 0 ;
2103
2103
var maxHeaderCanvasHeight = 0 ;
2104
2104
var i , container ;
2105
+ var getHeight = function ( oldVal , newVal ) {
2106
+ if ( oldVal !== newVal ) {
2107
+ rebuildStyles = true ;
2108
+ }
2109
+ return newVal ;
2110
+ } ;
2105
2111
for ( i = 0 ; i < containerHeadersToRecalc . length ; i ++ ) {
2106
2112
container = containerHeadersToRecalc [ i ] ;
2107
2113
@@ -2111,12 +2117,7 @@ angular.module('ui.grid')
2111
2117
}
2112
2118
2113
2119
if ( container . header ) {
2114
- var oldHeaderHeight = container . headerHeight ;
2115
- var headerHeight = container . headerHeight = parseInt ( gridUtil . outerElementHeight ( container . header ) , 10 ) ;
2116
-
2117
- if ( oldHeaderHeight !== headerHeight ) {
2118
- rebuildStyles = true ;
2119
- }
2120
+ var headerHeight = container . headerHeight = getHeight ( container . headerHeight , parseInt ( gridUtil . outerElementHeight ( container . header ) , 10 ) ) ;
2120
2121
2121
2122
// Get the "inner" header height, that is the height minus the top and bottom borders, if present. We'll use it to make sure all the headers have a consistent height
2122
2123
var topBorder = gridUtil . getBorderSize ( container . header , 'top' ) ;
@@ -2135,12 +2136,8 @@ angular.module('ui.grid')
2135
2136
}
2136
2137
2137
2138
if ( container . headerCanvas ) {
2138
- var oldHeaderCanvasHeight = container . headerCanvasHeight ;
2139
- var headerCanvasHeight = container . headerCanvasHeight = parseInt ( gridUtil . outerElementHeight ( container . headerCanvas ) , 10 ) ;
2139
+ var headerCanvasHeight = container . headerCanvasHeight = getHeight ( container . headerCanvasHeight , parseInt ( gridUtil . outerElementHeight ( container . headerCanvas ) , 10 ) ) ;
2140
2140
2141
- if ( oldHeaderCanvasHeight !== headerCanvasHeight ) {
2142
- rebuildStyles = true ;
2143
- }
2144
2141
2145
2142
// If the header doesn't have an explicit canvas height, save the largest header canvas height for use later
2146
2143
// Explicit header heights are based off of the max we are calculating here. We never want to base the max on something we're setting explicitly
@@ -2167,15 +2164,15 @@ angular.module('ui.grid')
2167
2164
maxHeaderHeight > 0 && typeof ( container . headerHeight ) !== 'undefined' && container . headerHeight !== null &&
2168
2165
( container . explicitHeaderHeight || container . headerHeight < maxHeaderHeight )
2169
2166
) {
2170
- container . explicitHeaderHeight = maxHeaderHeight ;
2167
+ container . explicitHeaderHeight = getHeight ( container . explicitHeaderHeight , maxHeaderHeight ) ;
2171
2168
}
2172
2169
2173
2170
// Do the same as above except for the header canvas
2174
2171
if (
2175
2172
maxHeaderCanvasHeight > 0 && typeof ( container . headerCanvasHeight ) !== 'undefined' && container . headerCanvasHeight !== null &&
2176
2173
( container . explicitHeaderCanvasHeight || container . headerCanvasHeight < maxHeaderCanvasHeight )
2177
2174
) {
2178
- container . explicitHeaderCanvasHeight = maxHeaderCanvasHeight ;
2175
+ container . explicitHeaderCanvasHeight = getHeight ( container . explicitHeaderCanvasHeight , maxHeaderCanvasHeight ) ;
2179
2176
}
2180
2177
}
2181
2178
0 commit comments