From 34ae74ec2519284dc181a49a27b0a56a4840483a Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 18 May 2017 15:29:35 +0800 Subject: [PATCH] update --- bi/base.js | 18 ++++++++++++++++-- docs/base.js | 18 ++++++++++++++++-- src/base/collection/collection.js | 9 ++++++++- src/base/grid/grid.js | 9 ++++++++- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/bi/base.js b/bi/base.js index ba2bebf1ce..e8dcccdbe4 100644 --- a/bi/base.js +++ b/bi/base.js @@ -2850,10 +2850,16 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -2864,6 +2870,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (items && items !== this.options.items) { this.options.items = items; this._calculateSizeAndPositionData(); + this.restore(); } this._populate(); } @@ -14953,10 +14960,16 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -14966,6 +14979,7 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { this.options.items = items; + this.restore(); } this._populate(); } diff --git a/docs/base.js b/docs/base.js index ba2bebf1ce..e8dcccdbe4 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2850,10 +2850,16 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -2864,6 +2870,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (items && items !== this.options.items) { this.options.items = items; this._calculateSizeAndPositionData(); + this.restore(); } this._populate(); } @@ -14953,10 +14960,16 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -14966,6 +14979,7 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { this.options.items = items; + this.restore(); } this._populate(); } diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index a4ee2e3d35..52acf14348 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -340,10 +340,16 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -354,6 +360,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (items && items !== this.options.items) { this.options.items = items; this._calculateSizeAndPositionData(); + this.restore(); } this._populate(); } diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 98bd8d3b27..4d79401c8a 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -312,10 +312,16 @@ BI.GridView = BI.inherit(BI.Widget, { this.renderRange = {}; }, + _clearChildren: function () { + this.container._children = {}; + this.container.attr("items", []); + }, + restore: function () { BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); + cell.el._destroy(); }); + this._clearChildren(); this.renderedCells = []; this.renderedKeys = []; this.renderRange = {}; @@ -325,6 +331,7 @@ BI.GridView = BI.inherit(BI.Widget, { populate: function (items) { if (items && items !== this.options.items) { this.options.items = items; + this.restore(); } this._populate(); }