Customised context menu

I would like to build a context menu for a tree. The contents of the context menu will depend on the tree node which has been selected and this requires some server-side computing. loadxml does not serve the purpose as the contents of the menu remain static. I tried to load an XML string using enableDynamicLoading but this does not display child components in the menu.

Is there any something which can be done to accomplish this task? Thanks in advance.

There is onBeforeContextMenu it occurs before menu is shown. You can use it to hide/show item.

Please, see the sample in tree package:

dhtmlxTree/samples/context_menu/pro_menu.html … _menu.html

I did check out onBeforeContextMenu, but it seems I will need to know in advance which items I need to hide or display. I will not know the contents of the context menu without doing some computation on the server-side. I am effectively looking to do a loadXML after each right-click on a tree node.

You can call loadXML from onBeforeContextMenu event:


return true