Skip to content

Commit

Permalink
[DataGrid] Fix bug in CRUD example (mui#14513)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelengelen authored and Arthur Balduini committed Sep 30, 2024
1 parent 38cbfcc commit 8bf945a
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 8bf945a

Please sign in to comment.