<ReactDataGrid />
supports inline editing, via the editable
boolean prop. It's up to you to hook to the onEditComplete({ value, columnId, rowId })
callback prop and apply the result of the editing.<ReactDataGrid />
does not force any method to update the data when onEditComplete
is called, editing can be easily customized to support both local and/or remove data persistence.column.editable=false
.column.editable: Fn(editValue, cellProps)
(or editable: Fn(editValue, cellProps)
) can also be a function, that either returns a boolean value, or a Promise
. In case the returned Promise
is rejected, or resolved with false
, the cell is not editable. Otherwise, it's considered editable.Ctrl+E
keyboard shortcut to start editing on the active row (can be changed by specifying the isStartEditKeyPressed({event})
).editable
DataGrid, the inline edit starts on that cell. When the user hits ESC
while in edit, the editing is canceled (onEditCancel({ columnId, rowId })
is called).Enter
triggers onEditComplete({ value, columnId, rowId })
and start editing the same column but on the next row (if there is one). Shift+Enter
does the same thing to the previous row (if one exist). Hitting the Tab
key, not only triggers onEditComplete
but also starts editing in the next column in the current row (if there is one). Shift+Tab
does the same, but goes to the previous column (if one exists).startEdit({ columnId, rowId })
. Also, cancelEdit()
cancels the edit, while completeEdit()
completes (and confirms) the edit. See the example below for an demo on how to start the edit on single click (using columns.cellDOMProps
)onEditComplete
and make an ajax call to update the data on server side, while also reloading the dataSource.editable
grid, you can have columns that are not editable, by specifying column.editable=false
.column.editor
, which should be a React Component.column.renderEditor(editorProps)
function and return a React.Node
that describes your editor.column.editor
, nor column.renderEditor
are specified, a default text editor is used for editing.@inovua/reactdatagrid-community
. The reason behind this is that we don't want to force a heavy bundle size on people not using inline editing or fancy editors like DateField
that have large external dependencies (eg: DateField
depends on momentjs).@inovua/reactdatagrid-community/BoolEditor
@inovua/reactdatagrid-community/DateEditor
@inovua/reactdatagrid-community/NumericEditor
columns.rendersInlineEditor
- see next section below for details .column.renderEditor
. Double-click on cells in the Student columncolumn.editor
or column.renderEditor(editorProps)
it is important that you call editorProps.onChange
and editorProps.onComplete
accordingly, when the user changes the value in the editor and when it completes/cancels the edit. It's also important that you call editorProps.onTabNavigation(complete: bool, direction)
so that the user can navigate from the editor to other editors in the row (either backwards or forwards - direction should be -1
for backwards and 1
for forwards).columns.rendersInlineEditor
for the columns that need this.column.render
function renders the editor correctly - see below for an example.Ctrl+E
keyboard shortcut to start editing on the active row (can be changed by specifying the isStartEditKeyPressed({event})
).TAB
while editing a cell on a row, will complete the edit and start editing the next cell in the row. If there is no other editable cell in the row, it will move to the first editable cell in the next row. The same is valid for SHIFT+TAB
but in the opposite direction.Ctrl+K
instead of the default Ctrl+E
,