dhtmlxTree and contextMenu question

Hi, I use dhtmlxTree with contextMenu and works fine :slight_smile:



But I have a question:

Is posible to get a context menu checked option depending of userData value of the xTree node?



Now I change a userData with the contextMenu but I want to view the selected userData in this men�.



It’s possible?



Thanks for all



Kind Regards

�lex Corretg�

You can attach custom code to onShow event of menu and update menu dynamically based on current node ( or its userdata )

aMenu.setOnShowMenuHandler(function(id){
    //id of item for which menu will be opened
    aMenu.menu.getItem(“some”).setText(tree.getUsedData(id,“some”));
});

Is possible to set a img src?

Now I have this function

       objAMenu.setOnShowMenuHandler(function(treeitemId){
               if(opcio = punterTreeAssoc[‘objA’].getUserData(treeitemId,‘simple_acl’))
               {
                   objAMenu.menu.getItem(opcio).setText(’* ’ + opcio);                           
               }
            });


To reset the old setText actions I need to re-process all menu items?

well I supose that I make a lot of work-arrounds to get the ‘Selected item’ menu functionality  :slight_smile:

Is possible to set a img src?
There is no API, but can be done as
     aMenu.menu.getItem(“some”).imageTag.src=“new url”;

>>well I supose that I make a lot of work-arrounds to get the ‘Selected item’ menu functionality  :slight_smile:
Actually to make menu specific for selected item - it is a too complex approach.
    dhtmlx.com/docs/products/dhtmlxG … 3423305000

You can create a set of necessary items in menu, and just use
    menu.showButtons
    menu.
hideButtons
to make it actual for currently selected item.