diff --git a/src/core/widget.js b/src/core/widget.js index a7017c403..0af5b6d90 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -125,6 +125,22 @@ callLifeHook(this, "created"); }, + _initCurrent: function () { + var o = this.options; + if (o._baseCls || o.baseCls || o.extraCls || o.cls) { + this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); + } + if (o.attributes) { + this.element.attr(o.attributes); + } + if (o.data) { + this.element.data(o.data); + } + if (o.css) { + this.element.css(o.css); + } + }, + /** * 初始化根节点 * @private @@ -152,18 +168,7 @@ this.element = BI.Widget._renderEngine.createElement(this); } this.element._isWidget = true; - if (o._baseCls || o.baseCls || o.extraCls || o.cls) { - this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); - } - if (o.attributes) { - this.element.attr(o.attributes); - } - if (o.data) { - this.element.data(o.data); - } - if (o.css) { - this.element.css(o.css); - } + this._initCurrent(); }, _initElementWidth: function () { @@ -559,6 +564,15 @@ this.element.empty(); }, + // 默认的populate方法就是干掉重来 + populate: function () { + this.purgeListeners(); + this.empty(); + this._initCurrent(); + this._init(); + this._initRef(); + }, + _destroy: function () { this.__d(); this.element.destroy();