|
|
@ -240,10 +240,11 @@ BI.Layout = BI.inherit(BI.Widget, { |
|
|
|
var w = this._newElement(newIndex, item); |
|
|
|
var w = this._newElement(newIndex, item); |
|
|
|
// 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到
|
|
|
|
// 需要有个地方临时存一下新建的组件,否则如果直接使用newIndex的话,newIndex位置的元素可能会被用到
|
|
|
|
this._children[this._getChildName(newIndex) + "-temp"] = w; |
|
|
|
this._children[this._getChildName(newIndex) + "-temp"] = w; |
|
|
|
if (oldIndex > 0) { |
|
|
|
var nextSibling = del.element[0].nextSibling; |
|
|
|
this._children[this._getChildName(oldIndex - 1)].element.after(w.element); |
|
|
|
if (nextSibling) { |
|
|
|
|
|
|
|
BI.Widget._renderEngine.createElement(nextSibling).before(w.element); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
w.element.prependTo(this._getWrapper()); |
|
|
|
w.element.appendTo(this._getWrapper()); |
|
|
|
} |
|
|
|
} |
|
|
|
del._destroy(); |
|
|
|
del._destroy(); |
|
|
|
w._mount(); |
|
|
|
w._mount(); |
|
|
@ -308,10 +309,11 @@ BI.Layout = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
this._addItemAt(index, item); |
|
|
|
this._addItemAt(index, item); |
|
|
|
var w = this._addElement(index, item); |
|
|
|
var w = this._addElement(index, item); |
|
|
|
if (index > 0) { |
|
|
|
var nextSibling = this._children[this._getChildName(index)].element[0].nextSibling; |
|
|
|
this._children[this._getChildName(index - 1)].element.after(w.element); |
|
|
|
if (nextSibling) { |
|
|
|
|
|
|
|
BI.Widget._renderEngine.createElement(nextSibling).before(w.element); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
w.element.prependTo(this._getWrapper()); |
|
|
|
w.element.appendTo(this._getWrapper()); |
|
|
|
} |
|
|
|
} |
|
|
|
w._mount(); |
|
|
|
w._mount(); |
|
|
|
return w; |
|
|
|
return w; |
|
|
|