Userdata at tree level rather than for each item

I would like to enable/disable a context menu for an entire tree depending on some userdata I receive.






Hello,


there is onBeforeContextMenu event that can be used to block menu appearing:


tree.attachEvent(“onBeforeContextMenu”,function(itemId){
return tree.getUserData(itemId,“isMenuEnabled”);
})




Thanks Alex. My earlier question was incomplete.

I am getting all the items for the tree from another source, and have no control over the userdata for individual items. I can only control things for the tree as a whole. I was hoping it would be possible to have tree-level userdata similar to what exists for a dhtmlxgrid. Is there any way of reading userdata which is present this form?:



    Y
    <item id=“123” …
.
.


Hello,


enableConetext userdata can be got by tree.getUserData(0,“enableContext”) method.