Skip to content

Commit

Permalink
fix(grid): adjust grid height when initial height is equal to row height
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvoznyakovsky committed Oct 28, 2015
1 parent aa7ab65 commit 33b4d6d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/js/core/directives/ui-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) );
Expand All @@ -63,7 +63,7 @@
}
deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) );
}


function columnDefsWatchFunction(n, o) {
if (n && n !== o) {
Expand All @@ -81,15 +81,15 @@
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];
} else {
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);
Expand Down Expand Up @@ -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();
}

Expand All @@ -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();
Expand Down

0 comments on commit 33b4d6d

Please sign in to comment.