SMART datagrid v.1 > Classes > EditValidation

Back  Forward

DataLudi.EditValidation.callback  property

Callback function which determines validation error. 

function (scope:Object):Boolean;

If explicitly return Boolean false, it will consider it as a validation failure. 

You can also validate by specifying expression in expression property instead of callback. Instead, if specify this callback, expression property will be ignored. The values which will be transferred to scope variable have been described in the table below. 

Defaults to null.

Getter
function callback(): Function
Setter
function setCallback(value: Function)
Table-1  Cell Validation Callback scope properties
PropertyExplanation
'index'The Location of data cell.
'row'The object of Grid Row.
'value'The value of data cell.
Code -1
    column.setValidations([{
	    "callback": function (scope) {
	        if (scope.value < 1000) {
	            return false;
	        }  
	    },
	    "level": DataLudi.ValidationLevel.ERROR,
	    "message": "The volume should be greater than 1000."
    }]);
See Also
expression
level
message
active
Validation Overview
Cell Editing Overview
Examples
Cell Editing
Cell Validation
Row Validation