ValidationRuleDefinitionCollection / PartialValidationRuleDefinitionCollection
Description
A ValidationRuleDefinitionCollection is an interface that is used to store all the ValidationRuleDefinition of the DataGrid’s options. Each ValidationRuleDefinition is stored under a specific key. It extends ResourceCollection<ValidationRuleDefinition>.
Property
|
Property |
Element |
Type |
Description |
|---|---|---|---|
|
key |
|
string |
The identifier of the |
|
|
value |
Example
The following validationRuleDefinitions defines three (3) ValidationRuleDefinition. Two (2) are custom by providing a validate function, and the third redefines the default range ValidationRuleDefinition by modifying its options.
const validationRuleDefinitions = {
"greaterZero": { validate: validateGreaterZero }, //custom
"lessTen": { validate: validateLessTen }, //custom
"range": { options: { min: 0, max: 15, errorMessage: "Value must be between 0 and 15." } } //redefine default
};
This validationRuleDefinitions can be used as the DataGridOptions.validationRuleDefinitions. The columns needing to use one of these ValidationRuleDefinition will need to add the validationRuleDefinition.key in their ColumnDefinition.validationRules property.
A partial type/interface is an object in which properties are optional.