0
votes

I am Trying to select a kendo Grid Row .when press "ENTER" key.

i tried below code:

("#grid").data("kendoGrid").table.focus();

this actually selects the table and focus to the cell.

But i want to select whole row.

3
Have you read the docs? Do you know if it is at all possible?Rob Schmuecker

3 Answers

3
votes

By Simply add this you can achieve this....try once..

 var selectFirstColumnOfKendoGrid = function () {
    var grid = $("#kendogrid").data("kendoGrid");
    var firstCell = grid.table.find("tr:first td:first");
    grid.current(firstCell);
    grid.table.focus();
    $('body').animate({ scrollTop: 0 }, 0);
}

in my app kendogrid is the id ...

1
votes

Try something like this :) The selector may be wrong because I don't know your HTML.

$(document).keypress(function(e) {

  if(e.which == 13) { //enter keycode

       $("#grid tr:first").focus();

   }

});
1
votes

Selecting the first row of a grid is:

grid.select($("tr:first", grid.tbody));

But I do not understand when you want to press "enter"... but might be a little tricky since keyboard key presses are bound to default handlers.