From 407dba164506ebdc009691e10b88e1027df7b24f Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 18 May 2017 16:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 34 +++++++++++++++++------------- bi/case.js | 2 +- docs/base.js | 34 +++++++++++++++++------------- docs/case.js | 2 +- src/base/collection/collection.js | 10 +++++---- src/base/grid/grid.js | 8 ++++--- src/base/table/table.collection.js | 8 +++---- src/base/table/table.grid.js | 8 +++---- src/case/table/table.adaptive.js | 2 +- 9 files changed, 60 insertions(+), 48 deletions(-) diff --git a/bi/base.js b/bi/base.js index e8dcccdbe4..005c9fea96 100644 --- a/bi/base.js +++ b/bi/base.js @@ -2775,8 +2775,12 @@ BI.CollectionView = BI.inherit(BI.Widget, { return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + this._calculateSizeAndPositionData(); + } if (o.items.length > 0) { this.container.setWidth(this._width); this.container.setHeight(this._height); @@ -2868,11 +2872,9 @@ BI.CollectionView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; - this._calculateSizeAndPositionData(); this.restore(); } - this._populate(); + this._populate(items); } }); BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; @@ -14869,8 +14871,11 @@ BI.GridView = BI.inherit(BI.Widget, { return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var self = this, o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + } if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; @@ -14978,10 +14983,9 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; this.restore(); } - this._populate(); + this._populate(items); } }); BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; @@ -28866,10 +28870,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { run(this.bottomLeftItems, o.items, leftItems); run(this.bottomRightItems, o.items, rightItems); - this.topLeftCollection.populate(leftHeader); - this.topRightCollection.populate(rightHeader); - this.bottomLeftCollection.populate(leftItems); - this.bottomRightCollection.populate(rightItems); + this.topLeftCollection._populate(leftHeader); + this.topRightCollection._populate(rightHeader); + this.bottomLeftCollection._populate(leftItems); + this.bottomRightCollection._populate(rightItems); }, _digest: function () { @@ -29696,10 +29700,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); - this.topLeftGrid.populate(this.header[0]); - this.topRightGrid.populate(this.header[1]); - this.bottomLeftGrid.populate(this.items[0]); - this.bottomRightGrid.populate(this.items[1]); + this.topLeftGrid._populate(this.header[0]); + this.topRightGrid._populate(this.header[1]); + this.bottomLeftGrid._populate(this.items[0]); + this.bottomRightGrid._populate(this.items[1]); }, _populate: function () { diff --git a/bi/case.js b/bi/case.js index 697267ae70..2fcf3869ee 100644 --- a/bi/case.js +++ b/bi/case.js @@ -8762,7 +8762,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, { freezeCols = []; } if (!BI.isNumber(columnSize[0])) { - columnSize = o.minColumnSize; + columnSize = o.minColumnSize.slice(); } var summaryFreezeColumnSize = 0, summaryColumnSize = 0; BI.each(columnSize, function (i, size) { diff --git a/docs/base.js b/docs/base.js index e8dcccdbe4..005c9fea96 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2775,8 +2775,12 @@ BI.CollectionView = BI.inherit(BI.Widget, { return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + this._calculateSizeAndPositionData(); + } if (o.items.length > 0) { this.container.setWidth(this._width); this.container.setHeight(this._height); @@ -2868,11 +2872,9 @@ BI.CollectionView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; - this._calculateSizeAndPositionData(); this.restore(); } - this._populate(); + this._populate(items); } }); BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; @@ -14869,8 +14871,11 @@ BI.GridView = BI.inherit(BI.Widget, { return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var self = this, o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + } if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; @@ -14978,10 +14983,9 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; this.restore(); } - this._populate(); + this._populate(items); } }); BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; @@ -28866,10 +28870,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { run(this.bottomLeftItems, o.items, leftItems); run(this.bottomRightItems, o.items, rightItems); - this.topLeftCollection.populate(leftHeader); - this.topRightCollection.populate(rightHeader); - this.bottomLeftCollection.populate(leftItems); - this.bottomRightCollection.populate(rightItems); + this.topLeftCollection._populate(leftHeader); + this.topRightCollection._populate(rightHeader); + this.bottomLeftCollection._populate(leftItems); + this.bottomRightCollection._populate(rightItems); }, _digest: function () { @@ -29696,10 +29700,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); - this.topLeftGrid.populate(this.header[0]); - this.topRightGrid.populate(this.header[1]); - this.bottomLeftGrid.populate(this.items[0]); - this.bottomRightGrid.populate(this.items[1]); + this.topLeftGrid._populate(this.header[0]); + this.topRightGrid._populate(this.header[1]); + this.bottomLeftGrid._populate(this.items[0]); + this.bottomRightGrid._populate(this.items[1]); }, _populate: function () { diff --git a/docs/case.js b/docs/case.js index 697267ae70..2fcf3869ee 100644 --- a/docs/case.js +++ b/docs/case.js @@ -8762,7 +8762,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, { freezeCols = []; } if (!BI.isNumber(columnSize[0])) { - columnSize = o.minColumnSize; + columnSize = o.minColumnSize.slice(); } var summaryFreezeColumnSize = 0, summaryColumnSize = 0; BI.each(columnSize, function (i, size) { diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 52acf14348..1b03201872 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -265,8 +265,12 @@ BI.CollectionView = BI.inherit(BI.Widget, { return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + this._calculateSizeAndPositionData(); + } if (o.items.length > 0) { this.container.setWidth(this._width); this.container.setHeight(this._height); @@ -358,11 +362,9 @@ BI.CollectionView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; - this._calculateSizeAndPositionData(); this.restore(); } - this._populate(); + this._populate(items); } }); BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 4d79401c8a..92798e55b8 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -221,8 +221,11 @@ BI.GridView = BI.inherit(BI.Widget, { return Math.max(0, this._rowSizeAndPositionManager.getTotalSize() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0)); }, - _populate: function () { + _populate: function (items) { var self = this, o = this.options; + if (items && items !== this.options.items) { + this.options.items = items; + } if (o.items.length > 0) { this.columnCount = o.items[0].length; this.rowCount = o.items.length; @@ -330,10 +333,9 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { - this.options.items = items; this.restore(); } - this._populate(); + this._populate(items); } }); BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; diff --git a/src/base/table/table.collection.js b/src/base/table/table.collection.js index e599bf5c92..dd31c1cc05 100644 --- a/src/base/table/table.collection.js +++ b/src/base/table/table.collection.js @@ -306,10 +306,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { run(this.bottomLeftItems, o.items, leftItems); run(this.bottomRightItems, o.items, rightItems); - this.topLeftCollection.populate(leftHeader); - this.topRightCollection.populate(rightHeader); - this.bottomLeftCollection.populate(leftItems); - this.bottomRightCollection.populate(rightItems); + this.topLeftCollection._populate(leftHeader); + this.topRightCollection._populate(rightHeader); + this.bottomLeftCollection._populate(leftItems); + this.bottomRightCollection._populate(rightItems); }, _digest: function () { diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 7c745644af..0746479242 100644 --- a/src/base/table/table.grid.js +++ b/src/base/table/table.grid.js @@ -347,10 +347,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this.contextLayout.attr("items", items); this.contextLayout.resize(); - this.topLeftGrid.populate(this.header[0]); - this.topRightGrid.populate(this.header[1]); - this.bottomLeftGrid.populate(this.items[0]); - this.bottomRightGrid.populate(this.items[1]); + this.topLeftGrid._populate(this.header[0]); + this.topRightGrid._populate(this.header[1]); + this.bottomLeftGrid._populate(this.items[0]); + this.bottomRightGrid._populate(this.items[1]); }, _populate: function () { diff --git a/src/case/table/table.adaptive.js b/src/case/table/table.adaptive.js index 88017193e4..7146b83a76 100644 --- a/src/case/table/table.adaptive.js +++ b/src/case/table/table.adaptive.js @@ -115,7 +115,7 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, { freezeCols = []; } if (!BI.isNumber(columnSize[0])) { - columnSize = o.minColumnSize; + columnSize = o.minColumnSize.slice(); } var summaryFreezeColumnSize = 0, summaryColumnSize = 0; BI.each(columnSize, function (i, size) {