How to open a submenu by presseng enter key?

2 posts, 0 answers
  1. RC
    RC avatar
    1 posts
    Member since:
    Apr 2010

    Posted 22 Feb 2013 Link to this post

    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!
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 22 Feb 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top