From 6a4e0d315a9d8a778b4a36e6f5c5367b5e4b85ad Mon Sep 17 00:00:00 2001 From: Young Date: Wed, 17 Jan 2018 15:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BCpopulate=E6=97=B6empty?= =?UTF-8?q?=E9=99=A4resize=E7=9B=B8=E5=85=B3=E5=85=83=E7=B4=A0=E5=A4=96?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E5=AD=90=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/widget/table/demo.responsive_table.js | 23 ++++++++++--------- dist/base.js | 10 +++++++- dist/bundle.js | 10 +++++++- dist/demo.js | 23 ++++++++++--------- src/base/table/table.js | 10 +++++++- 5 files changed, 51 insertions(+), 25 deletions(-) diff --git a/demo/js/widget/table/demo.responsive_table.js b/demo/js/widget/table/demo.responsive_table.js index 8009a5c9a..c52f73353 100644 --- a/demo/js/widget/table/demo.responsive_table.js +++ b/demo/js/widget/table/demo.responsive_table.js @@ -129,23 +129,24 @@ Demo.Func = BI.inherit(BI.Widget, { isNeedMerge: true, isNeedFreeze: true, mergeCols: [0, 1], - columnSize: ["", "", ""], - items: items, - header: header + items: [], + header: [] }); BI.createWidget({ type: "bi.absolute", element: this, items: [{ el: { - type: "bi.grid", - columns: 2, - rows: 2, - items: [{ - column: 0, - row: 0, - el: table1 - }] + type: "bi.tab", + defaultShowIndex: 1, + cardCreator: function (v) { + switch (v) { + case 1: + table1.attr("columnSize", ["", "", ""]); + table1.populate(items, header); + return table1; + } + } }, left: 10, right: 10, diff --git a/dist/base.js b/dist/base.js index 2ca8968d3..6910f18e9 100644 --- a/dist/base.js +++ b/dist/base.js @@ -33363,12 +33363,20 @@ BI.Table = BI.inherit(BI.Widget, { }, + _empty: function () { + this.scrollBottomRight && this.scrollBottomRight.destroy(); + this.topLeft && this.topLeft.destroy(); + this.topRight && this.topRight.destroy(); + this.bottomLeft && this.bottomLeft.destroy(); + this.bottomRight && this.bottomRight.destroy(); + }, + populate: function (items, header) { this.options.items = items || []; if (header) { this.options.header = header; } - this.empty(); + this._empty(); if (this.options.isNeedFreeze) { this._createFreezeTable(); } else { diff --git a/dist/bundle.js b/dist/bundle.js index fd8df4c45..ab3cfa6d7 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -59138,12 +59138,20 @@ BI.Table = BI.inherit(BI.Widget, { }, + _empty: function () { + this.scrollBottomRight && this.scrollBottomRight.destroy(); + this.topLeft && this.topLeft.destroy(); + this.topRight && this.topRight.destroy(); + this.bottomLeft && this.bottomLeft.destroy(); + this.bottomRight && this.bottomRight.destroy(); + }, + populate: function (items, header) { this.options.items = items || []; if (header) { this.options.header = header; } - this.empty(); + this._empty(); if (this.options.isNeedFreeze) { this._createFreezeTable(); } else { diff --git a/dist/demo.js b/dist/demo.js index 71d0d8249..a17fddb34 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -14090,23 +14090,24 @@ BI.shortcut("demo.preview_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget, { isNeedMerge: true, isNeedFreeze: true, mergeCols: [0, 1], - columnSize: ["", "", ""], - items: items, - header: header + items: [], + header: [] }); BI.createWidget({ type: "bi.absolute", element: this, items: [{ el: { - type: "bi.grid", - columns: 2, - rows: 2, - items: [{ - column: 0, - row: 0, - el: table1 - }] + type: "bi.tab", + defaultShowIndex: 1, + cardCreator: function (v) { + switch (v) { + case 1: + table1.attr("columnSize", ["", "", ""]); + table1.populate(items, header); + return table1; + } + } }, left: 10, right: 10, diff --git a/src/base/table/table.js b/src/base/table/table.js index b516457a9..5c034a75c 100644 --- a/src/base/table/table.js +++ b/src/base/table/table.js @@ -1580,12 +1580,20 @@ BI.Table = BI.inherit(BI.Widget, { }, + _empty: function () { + this.scrollBottomRight && this.scrollBottomRight.destroy(); + this.topLeft && this.topLeft.destroy(); + this.topRight && this.topRight.destroy(); + this.bottomLeft && this.bottomLeft.destroy(); + this.bottomRight && this.bottomRight.destroy(); + }, + populate: function (items, header) { this.options.items = items || []; if (header) { this.options.header = header; } - this.empty(); + this._empty(); if (this.options.isNeedFreeze) { this._createFreezeTable(); } else {