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

Context Menu demo

1 Answer 114 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rune
Top achievements
Rank 1
Rune asked on 31 Jul 2020, 11:21 AM

I'm looking at https://demos.telerik.com/kendo-ui/menu/context-menu and have a question about this piece of code:

var menu = $("#menu"),
    original = menu.clone(true);
 
original.find(".k-state-active").removeClass("k-state-active");
 
$("#apply").click(function (e) {
    e.preventDefault();
    var clone = original.clone(true);
 
    menu.getKendoContextMenu().destroy();
    clone.appendTo("#example");
 
    initMenu();
});

 

It clones the menu, it removes the active selection marker from any selected elements and then attaches a click event to all elements with Id = "apply".

But there are no apply elements in the code sample? And running this from the dojo with that code commented out seems to yield the same result.

Is it an example of how to handle context menus on other elements I might choose to put on that page? (but also for left-click though..?)

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 04 Aug 2020, 08:44 AM

Hello Rune,

This code is a leftover from a previous version of the demo. Currently, it does not have any purpose in this demo and we will remove it. Thank you for pointing this out.

You can see a similar logic being used in the Direction demo: https://demos.telerik.com/kendo-ui/menu/direction and the idea is to reinitialize the Menu after applying some changes to its configuration. In this case the direction its sub-menus open in.

Regards,
Ivan Danchev
Progress Telerik

Tags
Menu
Asked by
Rune
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or