|
|
@ -299,16 +299,22 @@ BI.Layout = BI.inherit(BI.Widget, { |
|
|
|
addItems: function (items, context) { |
|
|
|
addItems: function (items, context) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this, o = this.options; |
|
|
|
var fragment = BI.Widget._renderEngine.createFragment(); |
|
|
|
var fragment = BI.Widget._renderEngine.createFragment(); |
|
|
|
|
|
|
|
var wrapper = this._getWrapper(); |
|
|
|
var added = []; |
|
|
|
var added = []; |
|
|
|
BI.each(items, function (i, item) { |
|
|
|
BI.each(items, function (i, item) { |
|
|
|
var w = self._addElement(o.items.length, item, context); |
|
|
|
var w = self._addElement(o.items.length, item, context); |
|
|
|
self._children[self._getChildName(o.items.length)] = w; |
|
|
|
self._children[self._getChildName(o.items.length)] = w; |
|
|
|
o.items.push(item); |
|
|
|
o.items.push(item); |
|
|
|
added.push(w); |
|
|
|
added.push(w); |
|
|
|
fragment.appendChild(w.element[0]); |
|
|
|
var node = w.element[0]; |
|
|
|
|
|
|
|
var childNodes = wrapper[0].childNodes; |
|
|
|
|
|
|
|
// BI-45290 wrapper中已包含的node不需要再次添加(添加可能导致内部滚动条位置重置)
|
|
|
|
|
|
|
|
if (!BI.contains(childNodes, node)) { |
|
|
|
|
|
|
|
fragment.appendChild(node); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (this._isMounted) { |
|
|
|
if (this._isMounted) { |
|
|
|
this._getWrapper().append(fragment); |
|
|
|
wrapper.append(fragment); |
|
|
|
BI.each(added, function (i, w) { |
|
|
|
BI.each(added, function (i, w) { |
|
|
|
w._mount(); |
|
|
|
w._mount(); |
|
|
|
}); |
|
|
|
}); |
|
|
|