I’ve been searching around trying to find an answer for this, but so far cannot figure it out.
I have a tree and a right-click context menu with two levels of child nodes. When clicking one of the options, I have a specific function that executes. This all works fine. But when that function executes, I’d like to change the text of that child context menu item to show that it has been executed.
I see there is setItemText(mixed itemId,string text), but if I use this, it changes the menu for ALL nodes.
I’m looking more for something like setItemText(parentID,itemID,string text).
Hi
Better to mark tree item - it will more easier
You can do the next:
menu.attachEvent("onClick", onButtonClick);
...
function onButtonClick(menuitemId, type) {
var itemId = tree.contextID; //private property to get right mouse button clicked tree node
var itemText = tree.getItemText(itemId); //to get tree node text before context menu
if (menuitemId == 'mark'){ //i.e. it is your special menu item
someFunction(); //your executed function
tree.setItemText(itemId, itemText+"_marked"); //update your node text
tree.setItemColor(itemId,"#22a5e7"); //if you nedd you can just color instead of new text
}
}
function someFunction(){}
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan