SpreadJS 13
GC.Spread.Sheets.DataValidation Namespace / CriteriaType Enumeration
In This Topic
    CriteriaType Enumeration
    In This Topic
    Indicates the data validator criteria type.
    Members
    MemberDescription
    anyValueSpecifies that the data validation allows any type of value and does not check for a type or range of values.
    customSpecifies that the data validation uses a custom formula to check the cell value.
    dateSpecifies that the data validation checks for and allows date values satisfying the given condition.
    decimalValuesSpecifies that the data validation checks for and allows decimal values satisfying the given condition.
    listSpecifies that the data validation checks for and allows a value that matches one in a list of values.
    textLengthSpecifies that the data validation checks for and allows text values whose length satisfies the given condition.
    timeSpecifies that the data validation checks for and allows time values satisfying the given condition.
    wholeNumberSpecifies that the data validation checks for and allows whole number values satisfying the given condition.
    Example
    This example returns the type.
    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, 1, 1, 1, dv, GC.Spread.Sheets.SheetArea.viewport); 
    alert(dv.type());
    This example uses the CriteriaType enumeration.
    var textLengthCondition = new GC.Spread.Sheets.ConditionalFormatting.Condition(GC.Spread.Sheets.ConditionalFormatting.ConditionType.textLengthCondition);
    textLengthCondition.compareType(GC.Spread.Sheets.ConditionalFormatting.GeneralComparisonOperators.greaterThan);
    textLengthCondition.formula("$C$1"); // formula used to calculate a number.
    var validator = new GC.Spread.Sheets.DataValidation.DefaultDataValidator(textLengthCondition);
    validator.type(GC.Spread.Sheets.DataValidation.CriteriaType.custom);
    activeSheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport).validator(validator);
    spread.options.highlightInvalidData = true;
    activeSheet.setValue(0, 0, "abcf");
     
    //Set value 3 to $C$1, after this code, the value in Cell(0,0) is valid.
    activeSheet.setValue(0, 2, 3);
    //Set value 5 to $C$1, after this code, the value in Cel(0,0) is invalid.
    // activeSheet.setValue(0, 2, 5);
    Inheritance Hierarchy

    Object
       GC.Spread.Sheets.DataValidation.CriteriaType

    See Also