doonot doonot - 6 months ago 37
Java Question

Showing menu when right clicking on a item of a tree view

I have a treeview and I wanted to add right click support for the different items. This is how I did it:

The menu is shown only for the first root module (after right click), but not for the rest of the root modules. Can you tell me what I have to change, in order to get the menu for all root modules?

Thanks a lot, I much appreciate your answer.

Answer Source

Hiya Please see this demo or (Fixed the issue) or diff approach here

on rightclick you will get an alert.


    // If you want to disable showing the context menu when right clicking
    // on the document, the code below would do the trick.
        alert('right click capture');
        return false;

    var $tree = $("#tree").kendoTreeView(
        select: function (event)
            var $item = $(event.node);
            console.log( $item );
            alert( "selected" );

    // Find the item you want to select...
    var $selected = $('#selected');
    var $treePath = $selected.parentsUntil($tree, "li");

    var treeView = $'kendoTreeView');

    // Expand the tree in order to show the selected item
    treeView.expand( $treePath );

    // Gotta make both calls... $selected );
    treeView.trigger( 'select', {node: $selected} );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download