diff --git a/etemplate/js/et2_widget_tree.js b/etemplate/js/et2_widget_tree.js index 6ff8c9fffb..9b58f03a68 100644 --- a/etemplate/js/et2_widget_tree.js +++ b/etemplate/js/et2_widget_tree.js @@ -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