Question

I created a nested tree using XUL (no database was used to store items). I want to delete items from this tree by selecting the item (only 1 at a time) then click delete. I wrote Javascript function to delete as following 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 guess getParent() is not the right method but did not find any other method. Can someone give me some hints please. Thanks

Was it helpful?

Solution

Problem solved. It was my mistake. I just realized that delete cannot be used as a name of function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top