ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: cijojohn on December 08, 2017, 07:15:42 pm

Title: Restrict tab out to next cell if it is the last cell in row
Post by: cijojohn on December 08, 2017, 07:15:42 pm
Hi Team,

We want to customize the tab functionality in such a way that when it reaches to the last cell in the row, next tab should not focus to the first cell in the next row. Similarly for shift+tab ,if it is first cell in row, it should not go to the end of the previous row.

See the attached snapshot.

we are in the last cell of third row. Now if i press tab key, the focus will move to the first cell in the next row(Sno in this case). We want to restrict this behavior in our grids.

Please suggest ASAP

Title: Re: Restrict tab out to next cell if it is the last cell in row
Post by: paramvir on December 11, 2017, 11:44:49 am
Please add this to the initialization object of grid.

Code: [Select]
beforeCellKeyDown: function(evt, ui){
var keyCode = evt.keyCode,
KC = $.ui.keyCode;
if(ui.colIndx==this.getColModel().length-1){
if( (keyCode == KC.TAB && !evt.shiftKey) || keyCode == KC.RIGHT)
return false;
}
else if(ui.colIndx == 0){
if( (keyCode == KC.TAB && evt.shiftKey ) || keyCode == KC.LEFT)
return false;
}
}

http://jsfiddle.net/qpjgfmvt/
Title: Re: Restrict tab out to next cell if it is the last cell in row
Post by: cijojohn on December 11, 2017, 01:03:59 pm
can u suggest something similar for PQ 3.3 version? I think this event "beforeCellKeyDown" works for PQ version 4.

Thanks
Title: Re: Restrict tab out to next cell if it is the last cell in row
Post by: paramvir on December 11, 2017, 11:07:26 pm
use cellKeyDown instead of beforeCellKeyDown in v3
Title: Re: Restrict tab out to next cell if it is the last cell in row
Post by: paramvir on December 15, 2017, 06:12:48 pm
In v5, this is the default behaviour of key navigation.