Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by zoomsthru on Jul 30, 2009 07:04
open dhtmlx forum
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.

<tree id="0">
Answer posted by Alex (support) on Jul 30, 2009 07:38

Hello, 

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

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


Answer posted by zoomsthru on Jul 30, 2009 14:58
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?:

<tree id="0">
    <userdata name="enableContext">Y</userdata>
    <item id="123" .... </item>
.
.
</tree>
Answer posted by Alex (suport) on Jul 31, 2009 01:23

Hello, 

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