Delete buttons for each node

Hello, how can I add a delete button (red X) opposite each node in a tree? It should be link(image) that have something like click=“tree.deleteItem(this)”, but how can i know what id have this node?


there isn’t such a built-in functionality. You may try to use checkboxes functionality. But you need to redefine checkbox images: … boxes.html

So, the icon, that corresponds “unchecked” state, you may replace with some delete icon you want to use.

Checkbox images are defined in checkArray private property (an array):

tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);
/path to unchecked image/
tree.checkArray[0] = yourDeleteImage; /originally is iconUncheckAll.gif/

Note that image path is relative - images should be in the folder that you’ve defined in the setImagePath method.

Then you may define the onCheck event handler and delete item when it’s checked.