如何从嵌套的XUL树中删除项目? [英] How can I delete item from a nested XUL tree?

查看:84
本文介绍了如何从嵌套的XUL树中删除项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用XUL创建了一个嵌套树(没有数据库用于存储项目).我想通过选择项目(一次仅1个)从该树中删除项目,然后单击删除".我编写了要删除的Javascript函数,如下所示,但它不起作用.

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);
}

我猜getParent()不是正确的方法,但是没有找到任何其他方法.有人可以给我一些提示吗? 谢谢

I guess getParent() is not the right method but did not find any other method. Can someone give me some hints please. Thanks

推荐答案

问题已解决.是我的错我只是意识到删除不能用作函数的名称.

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

这篇关于如何从嵌套的XUL树中删除项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆