SpreadJS 13
GC.Spread.Sheets Namespace / Events type / ValidationError Event
The sheet that triggered the event.
The sheet's name.
The cell's row index.
The cell's column index.
The data validator that caused the error.
The policy that the user can set to determine how to process the error.
In This Topic
    ValidationError Event
    In This Topic
    Occurs when the applied cell value is invalid.
    Syntax
    var instance; // Type: Events
    instance.ValidationError = function(sheet, sheetName, row, col, validator, validationResult) { };
    ValidationError = function ( 
       sheet : Worksheet,
       sheetName : string,
       row : number,
       col : number,
       validator : DefaultDataValidator,
       validationResult : DataValidationResult
    ) { };

    Parameters

    sheet
    The sheet that triggered the event.
    sheetName
    The sheet's name.
    row
    The cell's row index.
    col
    The cell's column index.
    validator
    The data validator that caused the error.
    validationResult
    The policy that the user can set to determine how to process the error.
    Example
    This example uses the ValidationError event.
    var nCondition = new GC.Spread.Sheets.ConditionalFormatting.Condition(GC.Spread.Sheets.ConditionalFormatting.ConditionType.cellValueCondition);
    nCondition.compareType(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.equalsTo);
    nCondition.expected(0);
    //When the option is false, the validation fails and the red alert is displayed.
    //When the option is true, the blank cell is treated as zero and the validation is successful.
    nCondition.treatNullValueAsZero(false);
    var validator = new GC.Spread.Sheets.DataValidation.DefaultDataValidator(nCondition)
    validator.ignoreBlank(false);
    validator.type(GC.Spread.Sheets.DataValidation.CriteriaType.wholeNumber)
    activeSheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport).validator(validator);
    spread.options.highlightInvalidData = true;
    activeSheet.setValue(0, 0, null);
    
    //Type different values in cell (0,0). This event fires if the user types an invalid value.
    activeSheet.bind("ValidationError", vError);
     function vError(sender, args) {
    alert("error");
                }
    See Also

    Reference

    Events type