-
-
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
[data grid] How to move checked row from one grid to another grid in MUI Datagrid premium? #12008
Comments
Hi @yashwant-raut
|
@cherniavskii Thanks for going thorugh codesandbox and my question. "You have to make sure you don't have duplicated row ids, which is currently the case in the linked demo: MUI has this method updateRows Again thanks for the help. |
The pubsub pattern is nothing we came up with, but a software design pattern that can be used in a multitude of ways. Here is a basic overview of the pattern explained: Pub/Sub Pattern. In your case both grids could be publishing and subscribing to the events to allow for a bidirectional interaction
👍
Since |
@michelengelen thanks for the reply will try to implement this way. |
How did we do @yashwant-raut? |
Summary
I have two MUI datagrid side by side let say left grid a sending grid and right grid a receiving grid I have added checkbox selection to the sending grid and one button in the Grid toolbar. What I want is user will select a row using checkbox and click on assign row and that selected row will be added to the receiving grid
Examples
Currently How I have done it. This is codesandbox link please check this out
I want know is this correct way to do it are there any other way where I can use MUI API. I have premium subscription so I can access all the API's. Is there any example.
My method
Created context which will be consumed by both sending grid and receiving grid and whenever user select row and click on assign button. context will be updated and it will save selected row data in that context. As receiving grid also consuming that context It will get re rendered and it will use stored data in context and append in its rows and this is how new row will be added.
and set this data in state to use it later. on Assign button click I will store saved array data in context
And in receiving grid I have updated row like this
Motivation
I have application where user should have ability to add data from one grid to another grid. We also thought about using drag and drop approach but that approach does not involve ease of access to user.
Search keywords: How to move checked row from one grid to another grid in MUI Datagrid premium?
The text was updated successfully, but these errors were encountered: