DhtmlxTree update method

Hi,



I wish to update Text attributes of Items in my tree when certain condition applies. I’m using custom images for im0, im1 and im2 attributes of the Items. The code snippet looks like below:



if (tree.getLevel(nodeId) > 0 ) {

tree.updateItem(nodeId);

tree.setItemText(nodeId, ‘newLabel’);

tree.selectItem(nodeId, false);

}



However, when the tree was rendered following execution of above code, the custom images were changed to default images. How can the original images be preserved?



Thanks!


Hello,


the images should be set in the updateItem method. In the other case default images will be set. So, you can try to use the following approach:


if (tree.getLevel(nodeId) > 0 ) {


tree.updateItem(nodeId,“newLabel”,tree.getItemImage(nodeId,0),tree.getItemImage(nodeId,1),tree.getItemImage(nodeId,2));
tree.selectItem(nodeId, false);


}



This is great! Thanks!