Author Topic: Disabale Enter key click on Editable cell and Enable Mouse Double click for edit  (Read 1987 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Hello,
       Here we have a requirement like, once if I  Enter the focused editable cell it should focus to next editable cell, and double click on particular focused cell should allow me to edit the cell. And after editing If i press Enter It should focus next Editable cell.(cell should not be in editCell, only it should focus the particular cell). I tried With

editorKeyDown: function(evt, ui){            
   if(evt.keyCode == 13){
      evt.originalEvent.keyCode = 40;
   }
}
Because here evt.originalEvent.keyCode = 40; makes cell into editCell.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Quote
1. if I  Enter the focused editable cell it should focus to next editable cell, and double click on particular focused cell should allow me to edit the cell

use this event to focus on next adjacent cell ( RIGHT or DOWN key according to your need) . If you want to go to next editable cell, then you have to write a loop and call grid.isEditableCell and grid.isEditableRow to check editability of a cell.

Code: [Select]
beforeCellKeyDown: function(evt, ui){
var $cell = $(evt.originalEvent.target), KC = $.ui.keyCode;
if(evt.keyCode == KC.ENTER){
$cell.trigger({type:'keydown', keyCode:KC.RIGHT})
return false;
}
},


Quote
2. after editing If i press Enter It should focus next Editable cell. (cell should not be in editCell, only it should focus the particular cell)

This is the default behavior of key navigation in grid. Don't use any incompatible setting in editModel.