There is a simple sample with column validation:
function requiredFieldValidator(value) {
if (value == null || value == undefined || !value.length)
In order to extend the answer of @mike-gwilt, you can use the cellAttrs column options to specify (in your column definition) the regular expressions and the message to report, like this:
... { id: "columnId", name: "columnName", validator: RegexValidator, cellAttrs: {"reg":"^\\d{1,2}$", "msg": "The value should be a number of two digits."} ...
Then the html generated looks something like this:
Finally, as you can access the input element inside your validation function, define it like this:
function RegexValidator(value, input) {
var msg = input.parent().attr('msg');
var reg = new RegExp(input.parent().attr('reg'));
if (!reg.exec(value)) {
return { valid: false, msg: msg};
} else {
return { valid: true, msg: null };
}
}