|
|
@@ -399,28 +399,15 @@ var cacheTree = {
|
|
|
return iCount;
|
|
|
};
|
|
|
|
|
|
- Tree.prototype.insert = function (parentID, nextSiblingID, id, resort = true) {
|
|
|
+ Tree.prototype.insert = function (parentID, nextSiblingID, id) {
|
|
|
var parent = !parentID || parentID === -1 ? null : this.nodes[this.prefix + parentID];
|
|
|
var nextSibling = !nextSiblingID || nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
|
|
|
|
|
|
var newNode = this.addNode(parent, nextSibling, id);
|
|
|
- if (resort) {
|
|
|
- this.sortTreeItems();
|
|
|
- }
|
|
|
+ this.sortTreeItems();
|
|
|
|
|
|
return newNode;
|
|
|
};
|
|
|
- Tree.prototype.multiInsert = function (datas) {
|
|
|
- debugger;
|
|
|
- const newNodes = [];
|
|
|
- for (const data of datas) {
|
|
|
- const node = this.insert(data.ParentID, data.NextSiblingID, data.ID, true);
|
|
|
- newNodes.push(node);
|
|
|
- }
|
|
|
- this.roots = tools.reSortNodes(this.roots, true);
|
|
|
- this.sortTreeItems();
|
|
|
- return newNodes;
|
|
|
- }
|
|
|
// 一次性插入多个连续的同层节点
|
|
|
Tree.prototype.multiInsert = function (datas, preID) {
|
|
|
const newNodes = [];
|
|
|
@@ -452,7 +439,7 @@ var cacheTree = {
|
|
|
return newNodes;
|
|
|
}
|
|
|
// 插入某一完整片段到某节点的子项中
|
|
|
- Tree.prototype.insertByDatas = function (datas, preID) {
|
|
|
+ Tree.prototype.insertByDatas = function (datas) {
|
|
|
let rst = [];
|
|
|
for(let data of datas){
|
|
|
this.nodes[this.prefix + data.ID] = new Node(this, data.ID);
|