This is a migrated thread and some comments may be shown as answers.

Context menu item click on tree node double click

3 Answers 74 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Geoffrey Smith
Top achievements
Rank 1
Geoffrey Smith asked on 14 Aug 2009, 10:49 AM
Hello,

My tree view has got nodes with context menu item "Edit node". I'd like to trigger the same event (simulate clicking on the context menu item) by double clicking on the node in the tree.

Is it possible? Please help ...

Regards,
Kamil - Folding Space

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 14 Aug 2009, 11:07 AM
Hi Kamil,

Currently this is not possible. Double clicking a node can enter edit mode if this is enabled and will fire the OnClientDoubleClick client-side event. You can subscribe to that event and execute the code which is currently run when the user clicks the "Edit" item.

Regards,
Albert,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Geoffrey Smith
Top achievements
Rank 1
answered on 14 Aug 2009, 11:26 AM
Hi Albert,

Can you please post a quick example how to subscribe or even trigger to the context menu item click event so I can trigger it somewhere else?

I assume it will be something like:

function RadTree_DoubleClick(sender, eventArgs) {
    var node = eventArgs.get_node();    
    node.get_contextMenu().get_allItems()[0].click();                     
}

Thank you,
Kamil
0
Atanas Korchev
Telerik team
answered on 14 Aug 2009, 11:47 AM
Hi Geoffrey Smith,

Here is a sample implementation:

            function onDoubleClick(sender, args) {
                var node = args.get_node();
                var contextMenu = sender.get_contextMenus()[0];
               
                sender._contextMenuNode = node;
               
                var item = contextMenu.findItemByText("Edit");
               
                item.click();
            }

The highlighted code is important.

All the best,
Albert,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Geoffrey Smith
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Geoffrey Smith
Top achievements
Rank 1
Share this question
or