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

How to open a submenu by presseng enter key?

1 Answer 268 Views
Menu
This is a migrated thread and some comments may be shown as answers.
RC
Top achievements
Rank 1
RC asked on 22 Feb 2013, 10:32 AM
Hi Kendo Mastah,

How can I achieve that? Here is my code that doesn't work :(
It aims to trigger the right arrow key event by pressing the enter key while an item is active.

$(document).keyup(function (e) {
if (e.which == 13) {
	var press = $.Event("keypress");
   	press.ctrlKey = false;
        press.which = 39;
        $("#SourceColumnsMenu_mn_active").trigger(press);
}
});

Thanks!

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Feb 2013, 07:14 PM
Hello Robert,

The easiest way to achieve this is through the TreeView API. You could get the selected item using the select method and trigger the expand with the expand method.

 

$(document).keyup(function (e) {
    if (e.which == 13) {
        var treeview = $("#treeview").data("kendoTreeView");
        var selected = treeview.select();
        treeview.expand(selected);
    }
});

Please let me know if this was the functionality that you were looking for.

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Menu
Asked by
RC
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or