Skip to content

Commit

Permalink
fix(uiGridHeader): Use parseInt on header heights
Browse files Browse the repository at this point in the history
We were using parseInt but not in the right place, so browsers that use
fractional pixel values were not allowing the header to shrink
appropriately.
  • Loading branch information
c0bra committed Mar 31, 2015
1 parent e2a9660 commit 98ed010
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/features/selection/test/uiGridSelectionDirective.spec.js
Expand Up @@ -83,8 +83,6 @@ describe('ui.grid.selection uiGridSelectionDirective', function() {
it("doesn't prevent headers from shrinking when filtering gets turned off", function () {
// Header height with filtering on
var filteringHeight = $(elm).find('.ui-grid-header').height();

dump(elm.controller('uiGrid').grid.api.core.notifyDataChange);

parentScope.options.enableFiltering = false;
elm.controller('uiGrid').grid.api.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
Expand Down
8 changes: 2 additions & 6 deletions src/js/core/factories/Grid.js
Expand Up @@ -1860,9 +1860,7 @@ angular.module('ui.grid')

if (container.header) {
var oldHeaderHeight = container.headerHeight;
var headerHeight = gridUtil.outerElementHeight(container.header);

container.headerHeight = parseInt(headerHeight, 10);
var headerHeight = container.headerHeight = parseInt(gridUtil.outerElementHeight(container.header), 10);

if (oldHeaderHeight !== headerHeight) {
rebuildStyles = true;
Expand All @@ -1886,9 +1884,7 @@ angular.module('ui.grid')

if (container.headerCanvas) {
var oldHeaderCanvasHeight = container.headerCanvasHeight;
var headerCanvasHeight = gridUtil.outerElementHeight(container.headerCanvas);

container.headerCanvasHeight = parseInt(headerCanvasHeight, 10);
var headerCanvasHeight = container.headerCanvasHeight = parseInt(gridUtil.outerElementHeight(container.headerCanvas), 10);

if (oldHeaderCanvasHeight !== headerCanvasHeight) {
rebuildStyles = true;
Expand Down

0 comments on commit 98ed010

Please sign in to comment.