SMART datagrid v.1 > Functions

Back  Forward

DataLudi.throwValidationError  Function

Throw Validation exception. 

If specify column object in column parameter, error level icon will be displayed in the corresponding column cell. It can be called from GridBase.onValidateRow, onValidateCell

function throwValidationError (level: ValidationLevel, message: String, column: GridColumn);
Returns
Void
Parameters
level - ValidationLevel. required.
message - String. required.
column - GridColumn.
Code -1
    grid.onValidateRow = function (grid, row, inserting, values) {
        if (values.salary < 1000) {
            DataLudi.throwValidationError(DataLudi.ValidationLevel.ERROR, 'Salary is too low.');
        }
    };

    grid.onValidateCell = function (grid, index, inserting, value) {
        if (index.column.name() == 'colSalary' && value < 1000) {
            DataLudi.throwValidationError(DataLudi.ValidationLevel.ERROR, 'Salary is too low.', index.column);
        }
    };
See Also
ValidationLevel
onValidateRow
onValidateCell
Examples
Cell Editing