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

Kendo Menu Close

3 Answers 267 Views
Menu
This is a migrated thread and some comments may be shown as answers.
gregory
Top achievements
Rank 1
gregory asked on 13 Mar 2019, 07:52 AM

Note: the documentation on the Kendo menu provides how to close an item, but not the actual menu itself. 

For example, the menu documentation on the Kendo menu states:
//intialize the menu widget
    $("#menu").kendoMenu();
    // get a reference to the menu widget
    var menu = $("#menu").data("kendoMenu");

    // close the sub menu of "Item1"
    menu.close("#Item1");

3 Answers, 1 is accepted

Sort by
0
gregory
Top achievements
Rank 1
answered on 13 Mar 2019, 07:57 AM

I hit return or some other key and this accidentally posted. To finish, to close the entire menu use:

//intialize the menu widget
 $("#menu").kendoMenu();
  // get a reference to the menu widget
 var menu = $("#menu").data("kendoMenu");

 // close the entire menu
 menu.close();

This is fairly straightforward and intuitive, but I thought to document it here.

0
Accepted
Ivan Danchev
Telerik team
answered on 15 Mar 2019, 08:09 AM
Hello Gregory,

Alternatively, you could pass a selector that uses the Kendo UI classes ("k-menu" and "k-item") to the close method:
menu.close(".k-menu .k-item");

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
gregory
Top achievements
Rank 1
answered on 16 Mar 2019, 12:31 AM
Thanks- this is good to know! I had to close the menu on an onClick event as the jQuery scroll animation kept it open somehow. I could not find documentation, but it was an easy enough solution and thought to post it here. I hope that this was OK.
Tags
Menu
Asked by
gregory
Top achievements
Rank 1
Answers by
gregory
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or