SuccessValidationResult
Description
A SuccessValidationResult
is an interface that exposes a successful validation of a dataCell
’s edited content.
Properties
Property |
Type |
Description |
---|---|---|
isValid |
boolean |
true to indicate that the validation succeeded. |
Example
The validateGreaterZero
function receives a ValidationContext
parameter and returns a SuccessValidationResult
when the dataCell
’s edited value (retrieved from ValidationContext
.newValue
) is greater than zero.
function validateGreaterZero(validationContext)
{
if (validationContext.newValue < 0)
{
return {
isValid: false,
errorMessage: “integer value must be greater than 0”
};
}
return { isValid: true };
}
The validateGreaterZero
function should be set as a ValidationRuleDefinition
.validate
function. This ValidationRuleDefinition
should be set in the DataGridOptions
.validationRuleDefinitions
as a value. The key of this value should be used as the identifier on each of the columns needing this validationRule
on the ColumnDefinition
.validationRules
property.