Custom row validation
You can verify values on a cell-by-cell basis by using the onValidateRow event that the grid generates when row editing is complete.
onValidateRow event
onValdateRow The field name and edited value of the cell are passed as parameters of the event. After verifying the value and passing the error level and message as the return value of the event, the grid cannot complete editing (commit) and displays a message to the user.
Try changing the values of the ‘Age’ and ‘Contribution’ columns in the grid below.
gridView.onValidateRow = function(grid, itemIndex, dataRow, inserting, values) {
var error = {};
if (values.SaveCost < 50000) {
error.level = "error";
error.message = "Payment must be over 50,000.";
} else if (values.SaveCost > 100000) {
error.level = "warning";
error.message = "Payment must be less than 100,000.";
}
if (values. Age < 1) {
error.level = "error";
error.message = "Age must be greater than 1.";
} else if (values.Age > 60) {
error.level = "warning";
error.message = "You must be under 60.";
}
return error;
}
For levels, messages, error states, etc., see Cell Validation.