[]
▸ createDateValidator(typeOperator
, v1
, v2
): DefaultDataValidator
Creates a validator based on the data.
static
example
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);
Name | Type | Description |
---|---|---|
typeOperator |
ComparisonOperators |
The type of ComparisonOperators compare operator. |
v1 |
Object |
The first object. |
v2 |
Object |
The second object. |
The validator.
▸ createFormulaListValidator(formula
): DefaultDataValidator
Creates a validator based on a formula list.
static
example
activeSheet.setValue(0, 2, 5);
activeSheet.setValue(1, 2, 4);
activeSheet.setValue(2, 2, 5);
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createFormulaListValidator("$C$1:$C$3");
dv.showInputMessage(true);
dv.inputMessage("Pick a value from the list.");
dv.inputTitle("tip");
activeSheet.setDataValidator(1, 1, 1,1,dv,GC.Spread.Sheets.SheetArea.viewport);
var validList = activeSheet.getDataValidator(1, 1).getValidList(activeSheet, 1, 1);
alert(validList);
Name | Type | Description |
---|---|---|
formula |
string |
The formula list. |
The validator.
▸ createFormulaValidator(formula
): DefaultDataValidator
Creates a validator based on a formula.
static
example
spread.options.highlightInvalidData = true;
//The formula validator is valid if the formula condition returns true.
var dv = GC.Spread.Sheets.DataValidation.createFormulaValidator("A1>0");
dv.showInputMessage(true);
dv.inputMessage("Enter a value greater than 0 in A1.");
dv.inputTitle("Tip");
activeSheet.setDataValidator(0, 0, 1,1,dv,GC.Spread.Sheets.SheetArea.viewport);
Name | Type | Description |
---|---|---|
formula |
string |
The formula condition. |
The validator.
▸ createListValidator(source
): DefaultDataValidator
Creates a validator based on a list.
static
example
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(activeSheet.getDataValidator(1,1).getValidList(activeSheet,1,1));
Name | Type | Description |
---|---|---|
source |
string |
The list value. |
The validator.
▸ createNumberValidator(typeOperator
, v1
, v2
, isIntegerValue
): DefaultDataValidator
Creates a validator based on numbers.
static
example
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createNumberValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, "5", "20", true);
dv.showInputMessage(true);
dv.inputMessage("Value must be between 5 and 20.");
dv.inputTitle("tip");
activeSheet.setDataValidator(1, 1, 1,1,dv,GC.Spread.Sheets.SheetArea.viewport);
Name | Type | Description |
---|---|---|
typeOperator |
ComparisonOperators |
The type of ComparisonOperators compare operator. |
v1 |
Object |
The first object. |
v2 |
Object |
The second object. |
isIntegerValue |
boolean |
Set to |
The validator.
▸ createTextLengthValidator(typeOperator
, v1
, v2
): DefaultDataValidator
Creates a validator based on text length.
static
example
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createTextLengthValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan, "4", "20");
dv.showInputMessage(true);
dv.inputMessage("Number of characters must be greater than 4.");
dv.inputTitle("tip");
activeSheet.setDataValidator(1, 1, 1, 1, dv, GC.Spread.Sheets.SheetArea.viewport);
Name | Type | Description |
---|---|---|
typeOperator |
ComparisonOperators |
The type of ComparisonOperators compare operator. |
v1 |
Object |
The first object. |
v2 |
Object |
The second object. |
The validator.
▸ createTimeValidator(typeOperator
, v1
, v2
): DefaultDataValidator
Creates a validator based on the time.
static
example
spread.options.highlightInvalidData = true;
var dv = GC.Spread.Sheets.DataValidation.createTimeValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.between, '9:08:09', '19:08:09');
dv.showInputMessage(true);
dv.inputMessage("Enter a time between 9:08:09 and 19:08:09.");
dv.inputTitle("Tip");
sheet.setDataValidator(1, 1, dv);
Name | Type | Description |
---|---|---|
typeOperator |
ComparisonOperators |
The type of ComparisonOperators compare operator. |
v1 |
Object |
The first object. |
v2 |
Object |
The second object. |
The validator.