Cell Validation Config
The Predefined Configuration for the Cell Validation function
Cell Validation State
Property | Description |
---|---|
CellValidations | Custom Cell Validation Rules to prevent invalid edits |
Cell Validation Rule
Each Cell Validation Rule object contains just Predicate and Scope properties:
Property | Description |
---|---|
Predicate | What triggers a CellValidationRule. |
Scope | On which Column(s) the CellValidationRule can be applied |
Expression
Additionally a Query can be used to define the Cell Validation Rule which is defined as follows:
Property | Description |
---|---|
Expression | Expression which will be evaluated (using AdapTable parser) |
Name | Name of the Query - how it will appear in Query dropdown |
Example
// Create 4 Cell Validation Rules:
// 1. No Number columns can be negative (using DataType scope)
// 2. No Edits allowed for the Emmployee Column
// 3. Invoiced Cost column cannot be greater than 300
// 4. No Edits allowed for Order Cost column in rows where Status is cancelled
// Note: This last Cell Validation Rule additionally uses an Expression
export default {
CellValidation: {
CellValidations: [
{
Scope:{
DataTypes: ['Number'],
},
Predicate:{
PredicateId: 'Negative'
}
}
{
Scope: {
ColumnIds: ['Employee'],
},
Predicate: {
PredicateId: 'Any',
},
},
{
Scope: {
ColumnIds: ['InvoicedCost'],
},
Predicate: {
PredicateId: 'GreaterThan',
Inputs: [300],
},
},
{
Scope: {
ColumnIds: ['OrderCost'],
},
Predicate: {
PredicateId: 'Any',
},
Expression: '[status]="Cancelled" ',
},
],
},
} as PredefinedConfig;