From d7cf76b6ebbf8569da0775b09ec20051096e223f Mon Sep 17 00:00:00 2001 From: young Date: Wed, 26 Apr 2017 16:47:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20grid=E5=B8=83?= =?UTF-8?q?=E5=B1=80populate=E7=A9=BA=E6=95=B0=E7=BB=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 19 +++++++++++-------- docs/base.js | 19 +++++++++++-------- src/base/grid/grid.js | 19 +++++++++++-------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/bi/base.js b/bi/base.js index 0077aef3b..fc4d817c4 100644 --- a/bi/base.js +++ b/bi/base.js @@ -14750,16 +14750,19 @@ BI.Grid = BI.inherit(BI.Widget, { if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; - this.container.setWidth(this.columnCount * o.estimatedColumnSize); - this.container.setHeight(this.rowCount * o.estimatedRowSize); + } else { + this.rowCount = 0; + this.columnCount = 0; + } + this.container.setWidth(this.columnCount * o.estimatedColumnSize); + this.container.setHeight(this.rowCount * o.estimatedRowSize); - this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); - this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); + this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); + this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); - this._calculateChildrenToRender(); - this.element.scrollTop(o.scrollTop); - this.element.scrollLeft(o.scrollLeft); - } + this._calculateChildrenToRender(); + this.element.scrollTop(o.scrollTop); + this.element.scrollLeft(o.scrollLeft); }, setScrollLeft: function (scrollLeft) { diff --git a/docs/base.js b/docs/base.js index 0077aef3b..fc4d817c4 100644 --- a/docs/base.js +++ b/docs/base.js @@ -14750,16 +14750,19 @@ BI.Grid = BI.inherit(BI.Widget, { if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; - this.container.setWidth(this.columnCount * o.estimatedColumnSize); - this.container.setHeight(this.rowCount * o.estimatedRowSize); + } else { + this.rowCount = 0; + this.columnCount = 0; + } + this.container.setWidth(this.columnCount * o.estimatedColumnSize); + this.container.setHeight(this.rowCount * o.estimatedRowSize); - this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); - this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); + this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); + this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); - this._calculateChildrenToRender(); - this.element.scrollTop(o.scrollTop); - this.element.scrollLeft(o.scrollLeft); - } + this._calculateChildrenToRender(); + this.element.scrollTop(o.scrollTop); + this.element.scrollLeft(o.scrollLeft); }, setScrollLeft: function (scrollLeft) { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 21c96a0a5..fdce627c3 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -195,16 +195,19 @@ BI.Grid = BI.inherit(BI.Widget, { if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; - this.container.setWidth(this.columnCount * o.estimatedColumnSize); - this.container.setHeight(this.rowCount * o.estimatedRowSize); + } else { + this.rowCount = 0; + this.columnCount = 0; + } + this.container.setWidth(this.columnCount * o.estimatedColumnSize); + this.container.setHeight(this.rowCount * o.estimatedRowSize); - this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); - this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); + this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); + this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); - this._calculateChildrenToRender(); - this.element.scrollTop(o.scrollTop); - this.element.scrollLeft(o.scrollLeft); - } + this._calculateChildrenToRender(); + this.element.scrollTop(o.scrollTop); + this.element.scrollLeft(o.scrollLeft); }, setScrollLeft: function (scrollLeft) {