Skip to content

Commit

Permalink
fix(uiGridUtil): getBorderSize() missing "width"
Browse files Browse the repository at this point in the history
The correct property name to use is "borderWidth", not just "border".
"border" works in Chrome but was breaking in Firefox.

Also had to change .ui-grid-header's box-sizing to content-box so IE11
would include the border in height calcs. AND finally IE11 was returning
fractional heights so Grid parseInt()s the returned values.
  • Loading branch information
c0bra committed Oct 7, 2014
1 parent 97868e0 commit 174f252
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ angular.module('ui.grid')
var oldHeaderHeight = container.headerHeight;
var headerHeight = gridUtil.outerElementHeight(container.header);

container.headerHeight = headerHeight;
container.headerHeight = parseInt(headerHeight, 10);

if (oldHeaderHeight !== headerHeight) {
rebuildStyles = true;
Expand All @@ -1534,7 +1534,9 @@ angular.module('ui.grid')
// 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
var topBorder = gridUtil.getBorderSize(container.header, 'top');
var bottomBorder = gridUtil.getBorderSize(container.header, 'bottom');
var innerHeaderHeight = headerHeight - topBorder - bottomBorder;
var innerHeaderHeight = parseInt(headerHeight - topBorder - bottomBorder, 10);

innerHeaderHeight = innerHeaderHeight < 0 ? 0 : innerHeaderHeight;

container.innerHeaderHeight = innerHeaderHeight;

Expand Down
2 changes: 2 additions & 0 deletions src/js/core/services/ui-grid-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
borderType = 'border';
}

borderType += 'Width';

var val = parseInt(styles[borderType], 10);

if (isNaN(val)) {
Expand Down
1 change: 1 addition & 0 deletions src/less/header.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

.ui-grid-header {
border-bottom: 1px solid @borderColor;
box-sizing: content-box;;
}

.ui-grid-top-panel {
Expand Down

0 comments on commit 174f252

Please sign in to comment.