delete a leaf of the tree

This commit is contained in:
Klaus Leithoff 2013-05-13 14:40:44 +00:00
parent 85a198d9e6
commit 090f8b134e

View File

@ -421,6 +421,27 @@ var et2_tree = et2_inputWidget.extend(
if (typeof _label != 'undefined') this.input.setItemText(_newItemId,_label);
},
/**
* deleteItem, deletes an item by id
* @param _id ID of the node
* @param _selectParent select the parent node true/false
* @return void
*/
deleteItem: function(_id, _selectParent) {
if(this.input == null) return null;
this.input.deleteItem(_id, _selectParent);
// Update action
// since the action ID has to = this.id, getObjectById() won't work
var treeObj = egw_getAppObjectManager().getObjectById(this.id);
for(var i=0; i < treeObj.children.length; i++)
{
if(treeObj.children[i].iface && treeObj.children[i].iface.id == _id)
{
delete treeObj.children[i].iface;
}
}
},
/**
* setLabel, sets the Label of of an item by id
* @param _id ID of the node