Thursday, July 11, 2013

How to disable some context menu items on Telerik TreeView

There is an event named "OnClientContextMenuShowing" for Rad Treeview that calls javascipt function and passes 2 arguments "sender, args".
The Args parameter contains The current selected TreeNode and Context Menu Items.
You can enable or disable any Context menu item based on any attributes for the Current Selected Tree Node.

Here is a code snippet for the javascript function that demonstrate how can you get the current select Tree Node and the Context menu Items and how can you disable the items.
function onClientContextMenuShowing(sender, args) {
            var treeNode = args.get_node();
            if (treeNode._attributes != undefined) {
                if (treeNode._attributes._keys[0] == 'BoolFlag') {
                    // 0 refer to the Context Menu item index

No comments:

Post a Comment