The cell editing function allows you to modify data directly from the grid itself. When the function is enabled, just simply click on one of the cells and grid will go into edit mode. Now you can change the value by typing a new one and pressing enter. After that, you can notice that the value has changed in the selected cell. You can, also cancel the change by pressing the 'escape' key on your keyboard.
To enable this feature you have to set config cellEditing
to true.
You can set up various outputs in Generic UI Grid. If you want to be informed when one of the values has changed, you need to use sourceEdited output. The grid can also emit these information:
- when a user enters into cell edit mode,
- submits the change,
- cancels the change.
By observing one of these outputs you can do something with it e.g. send it to the server.
export interface GuiCellEdit {
enabled?: boolean;
rowEdit?: (value: any, item: any, index: number) => boolean;
cellEdit?: (value: any, item: any, index: number) => boolean
}
Input | Type | Default | Description |
---|---|---|---|
cellEditing | boolean | GuiCellEdit | false | Turns on cell editing. |
Output | Type | Description |
---|---|---|
sourceEdited | {after: any, before: any} | When source changes, grid emits value of previous and new values. |
cellEditEntered | void | When user clicks on the cell it will go into edit mode and this output will emit event. |
cellEditCanceled | void | When user cancels edit mode, this output will emit event. |
cellEditSubmitted | void | When user submits change of the edited value, this output will emit event. |