ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: lsl on September 23, 2014, 03:02:32 pm
-
If user edits the grid in the first column column1, I want to go to column3 if column1='3' else go to column4 after cell save.
I have coded as follows,
cellSave: function( event, ui ) {
if(ui.rowData["column1']=='3')
{$grid1.pqGrid( "editCell", { rowIndx: ui.rowIndx, dataIndx: "column3" });}
else
{$grid1.pqGrid( "editCell", { rowIndx: ui.rowIndx, dataIndx: "column4" });}
}
When I press tab to next field,it will be only go to column2. I think it went to the column3/column4 but go back to column2.
Does it have a event like "afterCellSave" or any other solution?
-
you can do that by setting column.editable = false for column2 and implementing column.editable callback for column3.
In the callback:
When cell in column1 == 3 then return true
else
return false
-
I have changed the coding as follows,
cellSave: function( event, ui ) {
if(ui.rowData["column1']=='3')
{
var colM=$grid1.pqGrid( "option" , "colModel" );
colM[2].editable = false;
$grid1.pqGrid( "option", "colModel", colM);
var rowIndx = ui.rowIndx;
$grid1.pqGrid( "refreshCell", { rowIndx: rowIndx, dataIndx: "column2" } );
}
}
When I tab out the column1, it will go to column2. But if I tab to the column3 and then tab back, the column2 is not editable and go to column1.
How to solve this problem?
-
You can't do this in cellSave event.
Assuming that you want the same behavior for tab forward and tab backward, please modify the colModel as per the steps mentioned in my previous message while initialization of grid ( not in cellSave event )
-
Can you give me the sample code about that?
-
Here is an example:
http://jsfiddle.net/paramquery/b6b710mz/