Editing Technical Reference
Summary
- Edit Options contains a number of useful editing-related options
- Cell Changed Event published by AdapTable whenever the contents of the Cell Changes
- Can be the result of a User edit in AG Grid or Ticking data updates
- The event provides full details of the change and where in AG Grid it happened
Edit Options
The Edit Options section of Adaptable Options contains these properties:
| Property | Type | Description | Default |
|---|---|---|---|
| customEditColumnValues | (context:CustomEditColumnValuesContext<TData>) =>CustomEditColumnValueInfo[] | Promise<CustomEditColumnValueInfo[]> | List of Column values to display when Editing (i.e. in Edit Lookups, Bulk Update) | |
| displayServerValidationMessages | boolean | Whether to display message after Server Validation runs | true |
| isCellEditable | (cellEditableContext:CellEditableContext<TData>) => boolean | Function which checks if a given Grid Cell is editable | |
| plusMinusOptions | PlusMinusOptions | Options for Plus Minus module (keyboard increment / decrement) | |
| showSelectCellEditor | (currentColumContext:AdaptableColumnContext<TData>) => boolean | Columns that will display a Select dropdown when editing | |
| smartEditOptions | SmartEditOptions<TData> | Options for Smart Edit module | |
| validateOnServer | (serverValidationContext:ServerValidationContext<TData>) => Promise<ServerValidationResult> | Function to validate AdapTable data edits remotely |
Smart Edit Options
The Smart Edit Options section contains these properties:
| Property | Type | Description |
|---|---|---|
| customOperations | SmartEditCustomOperation<TData>[] | Custom Operations to use in Smart Edit |
Plus Minus Options
The Plus Minus Options section contains these properties:
| Property | Type | Description | Default |
|---|---|---|---|
| decrementKey | string | Key to decrease cell value for nudges (if not overriden in Plus Minus Rule) | '-' |
| incrementKey | string | Key to increase cell value for nudges (if not overriden in Plus Minus Rule) | '+' |
Cell Changed Event
The Cell Changed Event fires whenever the contents of any cell changes in AG Grid.
This can be the result of a user cell edit or of ticking data.
CellChangedInfo
The event comprises the CellChangedInfo object:
| Property | Type | Description |
|---|---|---|
| cellDataChange | CellDataChangedInfo | Object providing full information of the cell (and column and row) that changed |
| adaptableContext | any | Custom application Context provided in AdaptableOptions.adaptableContext |
This provides a single cellChange property of type CellDataChangedInfo defined as follows:
| Property | Type | Description |
|---|---|---|
| changedAt | number | Timestamp of change occurrence (in milliseconds) |
| column | AdaptableColumn<TData> | Column in which cell is situated |
| newValue | any | New value for the cell |
| oldValue | any | Value in the Cell before the edit |
| preventEdit | boolean | Whether the change was prevented by a validation rule |
| primaryKeyValue | any | Primary Key Column's value for the row where edited cell is situated |
| rowData | TData | Data in the Row |
| rowNode | IRowNode<TData> | AG Grid RowNode that contains the cell |
| trigger | 'edit' | 'tick' | 'undo' | 'aggChange' | 'calculatedColumnChange' | What triggered the change - user, background change, a reverted change, or a derived update on a Calculated Column whose source value changed? |
Event Subscription
Subscribing to the Event is done the same way as with all Adaptable Events:
api.eventApi.on('CellChanged', (eventInfo: CellChangedInfo) => {
// do something with the info
});