How to remove an item from a nested XUL tree?

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

0
source share
1 answer

The problem is resolved. That was my fault. I just realized that delete cannot be used as a function name.

0
source

All Articles