gets index of the node in a specific branch
id | id | tree node ID |
parent | id | optional, ID of the parent node |
number | index of related tree node |
var files = webix.ui({
view:"filemanager",
data: [
{ id:"branch1", value:"Documents", date: 1420717913, type:"folder", data:[
{ id:"1.1", value:"Prices", type:"excel", date: 1420717913, size:"13" },
{ id:"1.2", value:"Products", type:"doc", date: 1420717913, size:"15" }
]}
]
});
var index = files.getBranchIndex("1.1"); // -> 0
var index1 = files.getBranchIndex("1.2"); // -> 1
For exact node specifying, pass both node ID and parent node ID into the function:
var sel = tree.getSelectedId();
var parent = tree.getParentId(sel);
tree.add({ value:"New item"}, tree.data.getBranchIndex(sel, parent), parent);