From 7e89d7895b21ed35eb5f97606824167403374f88 Mon Sep 17 00:00:00 2001 From: freein Date: Mon, 3 Nov 2014 14:52:18 +0100 Subject: [PATCH 1/2] hideHeader misplacement bug fixed --- src/js/core/directives/ui-grid-native-scrollbar.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/js/core/directives/ui-grid-native-scrollbar.js b/src/js/core/directives/ui-grid-native-scrollbar.js index ef1de40670..a34c07e4f6 100644 --- a/src/js/core/directives/ui-grid-native-scrollbar.js +++ b/src/js/core/directives/ui-grid-native-scrollbar.js @@ -80,9 +80,7 @@ // Update the vertical scrollbar's content height so it's the same as the canvas var contentHeight = rowContainer.getCanvasHeight(); - // TODO(c0bra): set scrollbar `top` by height of header row - // var headerHeight = gridUtil.outerElementHeight(containerCtrl.header); - var headerHeight = colContainer.headerHeight ? colContainer.headerHeight : grid.headerHeight; + var headerHeight = gridUtil.outerElementHeight(containerCtrl.header); // gridUtil.logDebug('headerHeight in scrollbar', headerHeight); From c556fafe50b7417f47986add9f14b79a9eb61ef0 Mon Sep 17 00:00:00 2001 From: freein Date: Mon, 3 Nov 2014 17:11:50 +0100 Subject: [PATCH 2/2] Performance improvement --- src/js/core/directives/ui-grid-native-scrollbar.js | 3 ++- src/js/core/factories/GridOptions.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/core/directives/ui-grid-native-scrollbar.js b/src/js/core/directives/ui-grid-native-scrollbar.js index a34c07e4f6..c314accc42 100644 --- a/src/js/core/directives/ui-grid-native-scrollbar.js +++ b/src/js/core/directives/ui-grid-native-scrollbar.js @@ -80,7 +80,8 @@ // Update the vertical scrollbar's content height so it's the same as the canvas var contentHeight = rowContainer.getCanvasHeight(); - var headerHeight = gridUtil.outerElementHeight(containerCtrl.header); + //var headerHeight = gridUtil.outerElementHeight(containerCtrl.header); + var headerHeight = colContainer.headerHeight ? colContainer.headerHeight : grid.headerHeight; // gridUtil.logDebug('headerHeight in scrollbar', headerHeight); diff --git a/src/js/core/factories/GridOptions.js b/src/js/core/factories/GridOptions.js index a978dcfe8f..11cda66830 100644 --- a/src/js/core/factories/GridOptions.js +++ b/src/js/core/factories/GridOptions.js @@ -128,8 +128,11 @@ angular.module('ui.grid') baseOptions.getRowIdentity = baseOptions.getRowIdentity || function getRowIdentity(row) { return row.$$hashKey; }; - - baseOptions.headerRowHeight = typeof(baseOptions.headerRowHeight) !== "undefined" ? baseOptions.headerRowHeight : 30; + if (baseOptions.hideHeader){ + baseOptions.headerRowHeight = 0; + }else { + baseOptions.headerRowHeight = typeof(baseOptions.headerRowHeight) !== "undefined" ? baseOptions.headerRowHeight : 30; + } baseOptions.rowHeight = baseOptions.rowHeight || 30; baseOptions.maxVisibleRowCount = baseOptions.maxVisibleRowCount || 200;