SMART datagrid v.1 > Classes > EditOptions

Back  Forward

DataLudi.EditOptions.validations  property

EditValidationCollection object which is the group of row unit EditValidation

The validations which have been set will be run when GridBase.commit the row. You can set cell unit validation in each DataColumn

Defaults to null.

Getter
function validations(): EditValidationCollection
Setter
function setValidations(value: EditValidationCollection)
Code -1
    column.setValidations([{
        criteria: "value > 1000",
        message: "The default price should be greater than 1000!",
        mode: "always",
        level: "warning"
    }, {
        criteria: "value < 20000",
        message: "The default price should be less than 20000!",
        mode: "always",
        level: "error"
    }]);

In most cases, when creating grid, it will be contained in column setting. 

Code -2
    grid.setColumns([{
        name: 'colPrice',
        fieldName: 'price',
        validations: [{
            criteria: "value > 1000",
            message: "The default price should be greater than 1000!",
            mode: "always",
            level: "warning"
        },
            ...
        ],
        ...
    }];
See Also
commitLevel
Cell Editing Overview
EditValidationCollection
EditValidation
DataColumn.validations
Examples
Cell Editing
Cell Validation
Row Validation