From 2b9bceac94356fcc61957b64cbd8bb57494327a1 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 27 Mar 2017 10:04:36 +0800 Subject: [PATCH] add --- bi/base.js | 6 ++++++ bi/core.js | 8 +++++++- dist/base.js | 6 ++++++ dist/core.js | 8 +++++++- src/base/combination/group.button.js | 6 ++++++ src/core/wrapper/layout.js | 8 +++++++- 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/bi/base.js b/bi/base.js index a2f1857aa..cc4bda455 100644 --- a/bi/base.js +++ b/bi/base.js @@ -1260,8 +1260,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { return node; }, + empty: function () { + BI.ButtonGroup.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + destroy: function () { BI.ButtonGroup.superclass.destroy.apply(this, arguments); + this.options.items = []; } }); BI.extend(BI.ButtonGroup, { diff --git a/bi/core.js b/bi/core.js index 86f4c95c0..32e7acbd0 100644 --- a/bi/core.js +++ b/bi/core.js @@ -12871,7 +12871,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = this.options.items.length; i > index; i--) { this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)]; } - delete this._children[index]; + delete this._children[this._getChildName(index)]; this.options.items.splice(index, 0, item); }, @@ -12879,6 +12879,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = index; i < this.options.items.length - 1; i++) { this._children[this._getChildName(i)] = this._children[this._getChildName(i + 1)]; } + delete this._children[this._getChildName(this.options.items.length - 1)]; this.options.items.splice(index, 1); }, @@ -13038,6 +13039,11 @@ BI.Layout = BI.inherit(BI.Widget, { }); }, + empty: function () { + BI.Layout.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + populate: function (items) { var self = this, o = this.options; items = items || []; diff --git a/dist/base.js b/dist/base.js index a2f1857aa..cc4bda455 100644 --- a/dist/base.js +++ b/dist/base.js @@ -1260,8 +1260,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { return node; }, + empty: function () { + BI.ButtonGroup.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + destroy: function () { BI.ButtonGroup.superclass.destroy.apply(this, arguments); + this.options.items = []; } }); BI.extend(BI.ButtonGroup, { diff --git a/dist/core.js b/dist/core.js index e1f12a6d4..cf049fa61 100644 --- a/dist/core.js +++ b/dist/core.js @@ -19469,7 +19469,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = this.options.items.length; i > index; i--) { this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)]; } - delete this._children[index]; + delete this._children[this._getChildName(index)]; this.options.items.splice(index, 0, item); }, @@ -19477,6 +19477,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = index; i < this.options.items.length - 1; i++) { this._children[this._getChildName(i)] = this._children[this._getChildName(i + 1)]; } + delete this._children[this._getChildName(this.options.items.length - 1)]; this.options.items.splice(index, 1); }, @@ -19636,6 +19637,11 @@ BI.Layout = BI.inherit(BI.Widget, { }); }, + empty: function () { + BI.Layout.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + populate: function (items) { var self = this, o = this.options; items = items || []; diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index c406acffb..06fbcf11d 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -297,8 +297,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { return node; }, + empty: function () { + BI.ButtonGroup.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + destroy: function () { BI.ButtonGroup.superclass.destroy.apply(this, arguments); + this.options.items = []; } }); BI.extend(BI.ButtonGroup, { diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index d0fec6bc0..09c15120e 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -181,7 +181,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = this.options.items.length; i > index; i--) { this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)]; } - delete this._children[index]; + delete this._children[this._getChildName(index)]; this.options.items.splice(index, 0, item); }, @@ -189,6 +189,7 @@ BI.Layout = BI.inherit(BI.Widget, { for (var i = index; i < this.options.items.length - 1; i++) { this._children[this._getChildName(i)] = this._children[this._getChildName(i + 1)]; } + delete this._children[this._getChildName(this.options.items.length - 1)]; this.options.items.splice(index, 1); }, @@ -348,6 +349,11 @@ BI.Layout = BI.inherit(BI.Widget, { }); }, + empty: function () { + BI.Layout.superclass.empty.apply(this, arguments); + this.options.items = []; + }, + populate: function (items) { var self = this, o = this.options; items = items || [];