Keydown Handler with Invalid Cell

2 posts, 0 answers
  1. Koren
    Koren avatar
    70 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2015 Link to this post

    I am using a custom keydown function that works great to get enter to work as a tab in Add mode and to close and move down a row in Update mode (batch editing on the grid).  However, I just realized that the enter key is closing the cell and moving down even if the cell validation fails.  How do I check whether the cell is valid before moving off the cell?

    Here is the portion of the keydown function that handles the enter key...


    if (e.keyCode === kendo.keys.ENTER) {            
                currentCell = $('td');
                currentRow = $('tr');
                cellIndex = currentCell.index();
                if (cellIndex > -1) {
                    grid = currentRow.closest("[data-role=grid").data("kendoGrid");                
                    model = grid.dataItem(currentRow);
                    if (model.isNew()) {
                        e.keyCode = kendo.keys.TAB;
                    else {
                        var nextRow =;
                        if (nextRow.length) {
                            var nextCell = nextRow.find("td").eq(cellIndex);
                            setTimeout(function () {
                            }, 50);

  2. Rosen
    Rosen avatar
    3253 posts

    Posted 30 Oct 2015 Link to this post

    Hello Koren,

    You can get reference to the editable (the internal widget which handles the edit form) and execute its end method. This method will trigger the validation and return true or false if it pass or not.

    if (grid.editable && grid.editable.end()) {
      // the edit form is valid do something here....

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top