Disable Expand/Collapse Right Click Tree

How can I disable expanding/collapsing nodes when the treeview is clicked? I tried to handle ClientSideOnNodeCollapse and ClientSideOnNodeExpand by returning false if MouseButtonPressed equals right, but it still collapses and expands. I also handle ClientSideOnNodeSelect and ClientSideOnContextMenu.

Thanks.


1 Reply

PN Pradeep N Syncfusion Team December 23, 2008 03:19 PM UTC

Hi Todd,

Thank you for your interest in Syncfusion Products.

The tree view nodes can be disabled using SetDisabled(true)Client side API.

Below i added a code snippet that disables the node on ClientSideOnNodeSelect(this) event on right click. We can select the nodes on Left Click.



function Expand(node)
{
var nodeitem = _sfTreeView1.FindNodeByID(node.ID);

if(node.MouseButtonPressed.Right==true)
nodeitem.SetDisabled(true);

}



Please let me know if this snippet helps you.

Thanks,
Pradeep,




Loader.
Up arrow icon