Skip to content

Commit f7ea294

Browse files
committed
Merge pull request #2008 from Envisage/master
include header,footer,scrollbar when calculating initial grid height
2 parents bb45941 + ed3d54c commit f7ea294

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/js/core/directives/ui-grid.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ angular.module('ui.grid').directive('uiGrid',
205205
// 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
206206
if (grid.gridHeight < grid.options.rowHeight) {
207207
// Figure out the new height
208-
var newHeight = grid.options.minRowsToShow * grid.options.rowHeight;
208+
var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight;
209+
var headerHeight = grid.options.hideHeader ? 0 : grid.options.headerRowHeight;
210+
var footerHeight = grid.options.showFooter ? grid.options.footerRowHeight : 0;
211+
var scrollbarHeight = grid.options.enableScrollbars ? gridUtil.getScrollbarWidth() : 0;
212+
213+
var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight;
209214

210215
$elm.css('height', newHeight + 'px');
211216

0 commit comments

Comments
 (0)