SpreadJS 13
GC.Spread.Sheets Namespace / CellRange type / validator Method
The cell data validator.
In This Topic
    validator Method
    In This Topic
    Gets or sets the data validator for the cell.
    Syntax
    var instance = new GC.Spread.Sheets.CellRange(sheet, row, col, rowCount, colCount, sheetArea);
    var returnValue; // Type: any
    returnValue = instance.validator(value);
    function validator( 
       value : DefaultDataValidator
    ) : any;

    Parameters

    value
    The cell data validator.

    Return Value

    If no value is set, returns the cell data validator; otherwise, returns the cell.
    Example
    The following examples use the dataValidator method.
    spread.options.highlightInvalidData = true;
    var dv = GC.Spread.Sheets.DataValidation.createDateValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, new Date(2012, 11, 31), new Date(2013, 11, 31));
    dv.showInputMessage(true);
    dv.inputMessage("Enter a date between 12/31/2012 and 12/31/2013.");
    dv.inputTitle("Tip");
    activeSheet.getCell(0,0).validator(dv);
    spread.options.highlightInvalidData = true;
    var dv = GC.Spread.Sheets.DataValidation.createDateValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, new Date(2012, 11, 31), new Date(2013, 11, 31));
    dv.showInputMessage(true);
    dv.inputMessage("Enter a date between 12/31/2012 and 12/31/2013.");
    dv.inputTitle("Tip");
    activeSheet.getCell(1, -1).validator(dv);
    spread.options.highlightInvalidData = true;
    var dv = GC.Spread.Sheets.DataValidation.createListValidator("1,2,3");
    dv.showInputMessage(true);
    dv.inputMessage("Value must be 1,2 or 3");
    dv.inputTitle("tip");
    activeSheet.setDataValidator(-1,0,dv);
    See Also

    Reference

    CellRange type