How can I delete item from a nested XUL tree? [closed]

拈花ヽ惹草 提交于 2019-12-12 05:37:53

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/3791433/how-can-i-delete-item-from-a-nested-xul-tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!