Skip to content
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

Add serverside row creation #3058

Merged
merged 17 commits into from
Jan 11, 2024
Merged

Add serverside row creation #3058

merged 17 commits into from
Jan 11, 2024

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Jan 5, 2024

Closes #2888

This PR introduces the following changes:

  • when the data provider contains a createRecord method, the grid will have an "add record" button in the toolbar
  • clicking this button will add a row at the top of the grid in draft mode
  • when clicking "update" after editing the row, the grid will call createRecord on the provider with the new values
  • all crud operations are disabled for all rows when one is in editing mode
  • a row in editing has to be explicitly updated or canceled, no focus events
  • createRecord and updateRecord must now return the created or updated record so the grid can update UI accordingly. This is important in scenarios where the server has to generate defaults for something
  • add a notification system for success/failure of the crud operations. When creating a new record, a link is created in the notification which scrolls the grid to the newly created item.

changes to public API:

  • dataprovider updateRecord can now optionally return a record to replace the one from the grid.
  • dataprovider now supports createRecord, which has the same signature as updateRecord minus the id parameter.
Screen.Recording.2024-01-09.at.18.36.17.mov

docs: https://deploy-preview-3058--mui-toolpad-docs.netlify.app/toolpad/concepts/data-providers/#row-creation

  • docs
  • tests

@bharatkashyap
Copy link
Member

A video might be helpful to those tracking progress/interested in this feature?

@Janpot

This comment was marked as outdated.

@Janpot Janpot added the new feature New feature or request label Jan 8, 2024
@Janpot Janpot marked this pull request as ready for review January 10, 2024 13:49
@Janpot Janpot requested a review from a team January 10, 2024 13:50
Janpot and others added 2 commits January 11, 2024 09:20
Co-authored-by: Bharat Kashyap <bharatkashyap@outlook.com>
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
@Janpot Janpot enabled auto-merge (squash) January 11, 2024 08:33
@Janpot Janpot merged commit 17088e2 into mui:master Jan 11, 2024
11 checks passed
@Janpot Janpot deleted the create-record branch January 11, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support server-side row creation
2 participants