Browse Source

update函数

es6
guy 8 years ago
parent
commit
d3129d6bb1
  1. 3
      demo/js/core/abstract/demo.virtual_group.js
  2. 11
      dist/core.js
  3. 4
      src/core/widget.js
  4. 7
      src/core/wrapper/layout.js

3
demo/js/core/abstract/demo.virtual_group.js

@ -66,14 +66,13 @@ Demo.Item = BI.inherit(BI.Widget, {
update: function (item) {
this.label.setText(item.value);
console.log("更新了一项");
return true;
},
created: function () {
console.log("创建了一项");
},
destroyed: function(){
destroyed: function () {
console.log("删除了一项");
}
});

11
dist/core.js vendored

@ -14342,9 +14342,7 @@ BI.Widget = BI.inherit(BI.OB, {
},
update: function () {
},
update: null,
destroyed: function () {
},
@ -19482,9 +19480,10 @@ BI.Layout = BI.inherit(BI.Widget, {
return;
}
var updated;
if (updated = this._children[this._getChildName(index)].update(this._getOptions(item))) {
return updated;
var child = this._children[this._getChildName(index)];
if (child.update) {
child.update(this._getOptions(item));
return true;
}
this._children[this._getChildName(index)].destroy();
var w = this._addElement(index, item);

4
src/core/widget.js

@ -43,9 +43,7 @@ BI.Widget = BI.inherit(BI.OB, {
},
update: function () {
},
update: null,
destroyed: function () {
},

7
src/core/wrapper/layout.js

@ -224,9 +224,10 @@ BI.Layout = BI.inherit(BI.Widget, {
return;
}
var updated;
if (updated = this._children[this._getChildName(index)].update(this._getOptions(item))) {
return updated;
var child = this._children[this._getChildName(index)];
if (child.update) {
child.update(this._getOptions(item));
return true;
}
this._children[this._getChildName(index)].destroy();
var w = this._addElement(index, item);

Loading…
Cancel
Save