I'm trying to solve the question 2 (Code-1, Code-2)
The only problem in this code "$grid.pqGrid("commit");" (focus does not allow cell next row)
Code-1
$grid.on("pqgridcelleditkeydown", function( event, ui ) {
keyCode=event.keyCode;
if (keyCode == 40) {
update(ui.rowIndx,ui.colIndx);
}
});
Code-2
function update(rowIndx,colIndx) {
if (!$grid.pqGrid("saveEditCell")) {
return false;
}
var rowData = $grid.pqGrid("getRowData", { rowIndx: rowIndx });
var isValid = $grid.pqGrid("isValid", { rowData: rowData }).valid;
if (!isValid) {
return false;
}
var isDirty = $grid.pqGrid("isDirty");
if (isDirty) {
var recIndx = $grid.pqGrid("option", "dataModel.recIndx");
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
var url = "PQGrid.asp?isl=Change";
if (rowData[recIndx] == null) {
url = "PQGrid.aso?isl=Save";
}
$.ajax($.extend({}, ajaxObj, {
url: url,
data: rowData,
success: function (data,textStatus,jqXHR) {
if (data.response=="error") {
$grid.pqGrid("addClass", {rowIndx:rowIndx, cls: 'ui-state-error'} );
}
else{
$grid.pqGrid("removeClass", {rowIndx:rowIndx, cls: 'ui-state-error'} );
var recIndx = $grid.pqGrid("option", "dataModel.recIndx");
if (rowData[recIndx] == null) {
rowData[recIndx] = data.recId;
}
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.pqGrid("commit");
}
}
}));
$grid.pqGrid("editCell", { rowIndx: rowIndx, colIndx: colIndx });
}
else {
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-edit' });
$grid.pqGrid("refreshRow", { rowIndx: rowIndx });
}
}
Question 3 problem continue...