ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: stancao on September 17, 2021, 03:33:07 am

Title: Do the left and right arrow keys work if the grid is on edit mode
Post by: stancao on September 17, 2021, 03:33:07 am
Hi,
I want to know that, do the left and right arrow keys work if the grid cell is on edit mode just like up and down arrow keys can do?

Thank you!

Stan
Title: Re: Do the left and right arrow keys work if the grid is on edit mode
Post by: paramvir on September 17, 2021, 08:45:50 am
Hi Stan

There is no ready to use option for it, but it can be customized using editorKeyDown event:

https://paramquery.com/pro/api#event-editorKeyDown

e.g. on left key, select the previous cell by decrementing the colIndx of current cell and return false to prevent default behavior inside the editor.

Code: [Select]
editorKeyDown: function(evt, ui){
if(evt.originalEvent.keyCode == $.ui.keyCode.LEFT){
ui.colIndx--;
this.setSelection(ui);
return false;
}
},

TODO: you would also need to check boundary conditions, e.g. if its the first leftmost cell, then it can't move further left.
Title: Re: Do the left and right arrow keys work if the grid is on edit mode
Post by: stancao on September 17, 2021, 07:48:56 pm
Thank you and they are working now! :)