-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Row and cell editing new examples for server-side persistence #3124
[docs] Row and cell editing new examples for server-side persistence #3124
Conversation
docs/src/pages/components/data-grid/editing/CellEditServerSidePersistence.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/editing/CellEditServerSidePersistence.tsx
Outdated
Show resolved
Hide resolved
const handleCellEditCommit = React.useCallback( | ||
async (params: GridCellEditCommitParams) => { | ||
// Get the row old value before committing | ||
const oldRow = apiRef.current.getRow(params.id)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get the row from the rows
prop and make this demo Community-compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} catch (error) { | ||
setSnackbar({ children: 'Error while saving user', severity: 'error' }); | ||
// Restore the row in case of error | ||
apiRef.current.updateRows([oldRow]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rows
prop can be updated instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/src/pages/components/data-grid/editing/RowEditServerSidePersistence.tsx
Outdated
Show resolved
Hide resolved
OK I was way to short on that one sorry, I'll fix those |
@@ -17,6 +17,14 @@ Set the `editable` property in the `GridColDef` object to `true` to allow editin | |||
|
|||
{{"demo": "pages/components/data-grid/editing/BasicEditingGrid.js", "bg": "inline", "defaultCodeOpen": false}} | |||
|
|||
### Server-side persistence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Closes #3101