views:

26

answers:

1

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

A: 

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

chepukha