From ed3d54c55b2f54f7f3471cef5155dd1d81334d99 Mon Sep 17 00:00:00 2001 From: Josh Kropf Date: Tue, 4 Nov 2014 10:47:58 -0500 Subject: [PATCH] include header,footer,scrollbar when calculating initial grid height --- src/js/core/directives/ui-grid.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/core/directives/ui-grid.js b/src/js/core/directives/ui-grid.js index 806b4e7feb..ad75e02cd0 100644 --- a/src/js/core/directives/ui-grid.js +++ b/src/js/core/directives/ui-grid.js @@ -205,7 +205,12 @@ angular.module('ui.grid').directive('uiGrid', // If the grid isn't tall enough to fit a single row, it's kind of useless. Resize it to fit a minimum number of rows if (grid.gridHeight < grid.options.rowHeight) { // Figure out the new height - var newHeight = grid.options.minRowsToShow * grid.options.rowHeight; + var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight; + var headerHeight = grid.options.hideHeader ? 0 : grid.options.headerRowHeight; + var footerHeight = grid.options.showFooter ? grid.options.footerRowHeight : 0; + var scrollbarHeight = grid.options.enableScrollbars ? gridUtil.getScrollbarWidth() : 0; + + var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight; $elm.css('height', newHeight + 'px');