Skip to content

Commit

Permalink
fix(uiGridHeader): Refresh grid with new header
Browse files Browse the repository at this point in the history
In the case that the header template was arriving in a promise, the grid
was not refreshing the canvas and recalculating the header element height.

Fixes #2822
  • Loading branch information
c0bra committed Feb 23, 2015
1 parent d3af956 commit d841b92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/js/core/directives/ui-grid-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
containerCtrl.headerViewport = headerViewport;
}
}

$scope.grid.queueRefresh();
});

function updateHeaderReferences() {
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1967,11 +1967,11 @@ angular.module('ui.grid')
container = containerHeadersToRecalc[i];

// If this header's height is less than another header's height, then explicitly set it so they're the same and one isn't all offset and weird looking
if (container.headerHeight < maxHeaderHeight) {
if (maxHeaderHeight > 0 && typeof(container.headerHeight) !== 'undefined' && container.headerHeight !== null && container.headerHeight < maxHeaderHeight) {
container.explicitHeaderHeight = maxHeaderHeight;
}

if (container.headerCanvasHeight < maxHeaderCanvasHeight) {
if (typeof(container.headerCanvasHeight) !== 'undefined' && container.headerCanvasHeight !== null && maxHeaderCanvasHeight > 0 && container.headerCanvasHeight < maxHeaderCanvasHeight) {
container.explicitHeaderCanvasHeight = maxHeaderCanvasHeight;
}
}
Expand Down

0 comments on commit d841b92

Please sign in to comment.