1
Help for ParamQuery Pro / Check Grid Validation before calling a Saving
« on: January 19, 2016, 10:23:56 am »
I am trying to check that there are no validation errors in the grid before I call ajax to save the data. Even when the grid has a triangle in a cell and is aware there is a validation error the below .pqGrid("isValid", { rowData: rowData }) evaluates true. What am I missing?
var errosWithData = TargetToolDataGrid.isValid($("#grid_Top"));
if (errosWithData == -1) {
alert("There is nothing to save.");
} else if (errosWithData > 0) {
alert("There are invalid entries on row "+errosWithData+". Look for cells with a triangle in the upper right corner.");
}
var TargetToolDataGrid = {
isValid: function (gridToCheck) {
debugger;
var dataModelMgr = gridToCheck.pqGrid("option", "dataModel");
var dataMgr = dataModelMgr.data;
if (dataMgr.length > 0) {
for (var i = 0, len = dataMgr.length; i < len; i++) {
var rowData = gridToCheck.pqGrid("getRowData", { rowIndx: i });
if (!gridToCheck.pqGrid("isValid", { rowData: rowData })) {
return i; //row with error
}
}
return 0; // zero errors
}
return -1; //no data
}
}
var errosWithData = TargetToolDataGrid.isValid($("#grid_Top"));
if (errosWithData == -1) {
alert("There is nothing to save.");
} else if (errosWithData > 0) {
alert("There are invalid entries on row "+errosWithData+". Look for cells with a triangle in the upper right corner.");
}
var TargetToolDataGrid = {
isValid: function (gridToCheck) {
debugger;
var dataModelMgr = gridToCheck.pqGrid("option", "dataModel");
var dataMgr = dataModelMgr.data;
if (dataMgr.length > 0) {
for (var i = 0, len = dataMgr.length; i < len; i++) {
var rowData = gridToCheck.pqGrid("getRowData", { rowIndx: i });
if (!gridToCheck.pqGrid("isValid", { rowData: rowData })) {
return i; //row with error
}
}
return 0; // zero errors
}
return -1; //no data
}
}