Batch editing allows you to edit multiple cells in the grid before committing the changes. This is useful for scenarios where you want to make several edits at once without immediately updating the data source.
Batch editing is an advanced feature only available via the API to allow you to tailor it to your specific needs.
Enabling Batch Editing Copy Link
TODO: Simple Example with: 1) enable/disable buttons, 2) start/stop/cancel buttons
Single Cell Editing Copy Link
TODO: Single Cell Example
When you start editing a cell, the grid enters a state where it can track changes made to that cell. The following lifecycle events are triggered:
Editing a cell has started. |
Editing a cell has stopped. |
Full Row Editing Copy Link
TODO: FullRow Example
When you edit a full row, the grid allows you to edit multiple cells in that row before committing the changes. The following lifecycle events are triggered:
Editing a cell has started. |
Editing a cell has stopped. |
Editing a row has started (when row editing is enabled). When row editing, this event will be fired once and cellEditingStarted will be fired for each individual cell. Only fires when doing Full Row Editing. |
Editing a row has stopped (when row editing is enabled). When row editing, this event will be fired once and cellEditingStopped will be fired for each individual cell. Only fires when doing Full Row Editing. |
Batch Editing Lifecycle Copy Link
As more cells are edited, each new edit will emit start events as required, but the stop events will only be emitted when the batch is completed.
Important Differences To Non-Batch Editing Copy Link
- In batch editing, the grid does not immediately update the data source when a cell is edited. Instead, it tracks changes until you explicitly commit them.
- The grid allows you to edit multiple cells in a row without committing changes until you decide to do so.
Clipboard Interaction Copy Link
The grid supports clipboard operations during batch editing. You can copy and paste data into the grid, and it will respect the batch editing state.
Exporting Data Copy Link
When exporting data from the grid, you can choose to include any pending changes made during batch editing. The exported data will reflect the changes made in the batch editing session. This is off by default.
Custom Renderers Copy Link
The ICellRendererComp
interface provides a means for your cell renderer to update when edits are batched, to reflect the pending nature of the values. The refresh
method that the grid calls when the cell needs to be re-rendered. The parameters include the latest pending value.
Properties available on the ICellRendererComp<TData = any>
interface.
Get the cell to refresh. Return true if successful. Return false if not (or you don't have refresh logic), then the grid will refresh the cell for you.
|
Custom editors Copy Link
As with custom renderers, the ICellEditor
interface includes the refresh
method, which the grid calls when the cell needs to be re-rendered. The parameters include the latest pending value.
Properties available on the ICellEditor<TValue = any>
interface.
Optional: Gets called with the latest cell editor params every time they update
|
Batch Editing API Copy Link
The grid has the following API methods for editing:
Start/Stop batch editing. Note that any pending edits will be lost when batch editing is disabled. |
Returns true if batch editing is enabled |
Start editing the provided cell. If another cell is editing, the editing will be stopped in that other cell. |
If a cell is editing, it stops the editing. Pass true if you want to cancel the editing (i.e. don't accept changes). |
If the grid is editing, returns back details of the editing cell(s). |
Set currently pending cell updates when in batch editing mode. Specify params.update=true to update current state, otherwise pending state will be replaced. |
Batch editing allows you to control when the grid stops editing. This is useful when you want to edit multiple cells before committing the changes. The example below shows how to use batch editing.