Search code examples
gridw2ui

w2ui grid inline edit enter-key behaviour


when inline-editing a text column in the w2ui.grid the ENTER key applies the change AND starts editing one row below.

How can I prevent the editing of the line below, but only apply the changes to the current row?

Thank you.


Solution

  • You can do this by cancelling the edit event if the previous keycode was ENTER.

    w2ui.grid.onEditField = function(event){
      if(event.originalEvent.keyCode === 13){
         event.preventDefault();
      }
    };   
    

    fiddle: http://jsfiddle.net/ty77umx1/1/