Skip to content

Commit

Permalink
[DataGrid] Fix bug in CRUD example (#14513)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelengelen authored Sep 9, 2024
1 parent dd98382 commit 1b4d3b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/data/data-grid/editing/FullFeaturedCrudGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ function EditToolbar(props) {

const handleClick = () => {
const id = randomId();
setRows((oldRows) => [...oldRows, { id, name: '', age: '', isNew: true }]);
setRows((oldRows) => [
...oldRows,
{ id, name: '', age: '', role: '', isNew: true },
]);
setRowModesModel((oldModel) => ({
...oldModel,
[id]: { mode: GridRowModes.Edit, fieldToFocus: 'name' },
Expand Down
5 changes: 4 additions & 1 deletion docs/data/data-grid/editing/FullFeaturedCrudGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function EditToolbar(props: EditToolbarProps) {

const handleClick = () => {
const id = randomId();
setRows((oldRows) => [...oldRows, { id, name: '', age: '', isNew: true }]);
setRows((oldRows) => [
...oldRows,
{ id, name: '', age: '', role: '', isNew: true },
]);
setRowModesModel((oldModel) => ({
...oldModel,
[id]: { mode: GridRowModes.Edit, fieldToFocus: 'name' },
Expand Down

0 comments on commit 1b4d3b2

Please sign in to comment.