The Grid allows users to create, update, and delete rows. You can manage the editing state and edit data programmatically. The editing state contains information about rows and cells being edited, and rows that have been created or deleted but not yet committed. Once a user finishes editing a row (clicks the Save or Delete button), the
EditingState plugin raises the
onCommitChanges event, and resets the row’s editing state. This same event is also raised when a user finishes editing a cell in inline editing mode.
The following plugins implement editing features:
Note that the plugin order is important.
Add the plugins listed above to the Grid to set up a simple Grid supporting editing features.
onCommitChanges event to commit changes made by an end-user to your data store.
In uncontrolled mode, you can specify the initial editing state values using the following
EditingState plugin’s properties:
defaultEditingRowIds- the rows being edited
defaultAddedRows- the rows being added
defaultRowChanges- the row changes
defaultDeletedRowIds- the rows being deleted
In controlled mode, specify the following
EditingState plugin’s property pairs to set a state value and handle its changes:
onEditingRowIdsChange- the rows being edited
onAddedRowsChange- the rows being added
onRowChangesChange- the row changes
onDeletedRowIdsChange- the rows being deleted
Note, you can also use the
onAddedRowsChange event to initialize a created row with default property values.
End-users can click cells and thus activate in-place editors, provided that you include the
TableInlineCellEditing plugin into the Grid’s configuration. To save changes, they can move focus or press Enter. Esc discards changes and deactivates the cell editor.
TableInlineCellEditing can be coupled with the
TableEditColumn plugins to provide richer functionality. For example, in the following code, users can not only activate in-place editors for individual cells, but also switch entire rows to edit mode:
You can prevent editing of a specific column using the EditingState plugin’s