I created a nested tree using XUL (no database was used to store items). I want to remove items from this tree by selecting an item (only one at a time), then click Delete. I wrote a Javascript function to delete, as shown below, but it does not work.
function delete(){
var tree = document.getElementById("treeId");
currentPos = tree.currentIndex;
var currentItem = tree.contentView.getItemAtIndex(currentPos);
var parent = currentItem.getParent();
parent.removeChild(currentItem);
}
I think getParent () is not the right method, but could not find another method. Can someone give me some hints please. Thanks
source
share