From 33b4d6d2b2f4f5ff9b64e1cc3cc658dc267b7266 Mon Sep 17 00:00:00 2001 From: Ivan Voznyakovsky Date: Wed, 28 Oct 2015 17:24:18 +0200 Subject: [PATCH] fix(grid): adjust grid height when initial height is equal to row height --- src/js/core/directives/ui-grid.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/core/directives/ui-grid.js b/src/js/core/directives/ui-grid.js index 59871a52b0..4e91f234b7 100644 --- a/src/js/core/directives/ui-grid.js +++ b/src/js/core/directives/ui-grid.js @@ -44,10 +44,10 @@ deregFunctions.push( $scope.$parent.$watch($scope.uiGrid.data, dataWatchFunction) ); deregFunctions.push( $scope.$parent.$watch(function() { if ( self.grid.appScope[$scope.uiGrid.data] ){ - return self.grid.appScope[$scope.uiGrid.data].length; + return self.grid.appScope[$scope.uiGrid.data].length; } else { return undefined; - } + } }, dataWatchFunction) ); } else { deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data; }, dataWatchFunction) ); @@ -63,7 +63,7 @@ } deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) ); } - + function columnDefsWatchFunction(n, o) { if (n && n !== o) { @@ -81,7 +81,7 @@ function dataWatchFunction(newData) { // gridUtil.logDebug('dataWatch fired'); var promises = []; - + if ( self.grid.options.fastWatch ){ if (angular.isString($scope.uiGrid.data)) { newData = self.grid.appScope[$scope.uiGrid.data]; @@ -89,7 +89,7 @@ newData = $scope.uiGrid.data; } } - + if (newData) { // columns length is greater than the number of row header columns, which don't count because they're created automatically var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0); @@ -277,7 +277,7 @@ function uiGridDirective($compile, $templateCache, $timeout, $window, gridUtil, grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm); // 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 && grid.options.enableMinHeightCheck) { + if (grid.gridHeight <= grid.options.rowHeight && grid.options.enableMinHeightCheck) { autoAdjustHeight(); } @@ -291,7 +291,7 @@ function uiGridDirective($compile, $templateCache, $timeout, $window, gridUtil, var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight; var headerHeight = grid.options.showHeader ? grid.options.headerRowHeight : 0; var footerHeight = grid.calcFooterHeight(); - + var scrollbarHeight = 0; if (grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) { scrollbarHeight = gridUtil.getScrollbarWidth();