-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Support edit functionality with server-side data source #13261
Comments
Hi @MBilalShafi, We are using data source with tree data with Apollo client, without data source cache. We are looking to implement some edit functionality to some cells. Using the edit mode and We also tried not using edit cells and just fire a mutation directly from the We would really like to use edit cells though so my question is are you aware of a workaround we could use here with edit cells and Best regards, |
I was curious about how would this be implemented so I went and read some of the code related to this. It does not seem too difficult to implement and I might be able to contribute this. I'm thinking that in Updating the data source cache seems a bit difficult though. Obviously easiest would be to just clear it after a row update, but I don't know if that is acceptable here. If we were to improve the data source cache so that all the rows are in a separate data structure and the But let me know what you think and if I'm completely wrong about this. Would be fun to do some open source! |
Hi @MBilalShafi, Thanks in advance. Premium customer - Support ID: 102668 |
Hi @ptuukkan, Apologies for the delayed response.
I'd love to take a look at this and provide a workaround. Could you prepare a minimal reproduction of the current implementation that you have that portrays the challenges you mentioned? It will be helpful in pin-pointing the specific pain points and suggesting a possible solution.
Correct, one of the main challenges is around the proper cache mutation and making the row updates stable and aligned with the backend server. Regarding your query, we always appreciate community contributions. Feel free to shoot a PR or reach out if you have any questions. In any case, it's already one of the top priorities for the team atm, see the answer regarding an ETA below. 👇
@sparksm Thank you for reaching out. Let me know if you have further questions or suggestions on the DX of the feature. |
Thanks for the response @MBilalShafi.
We have the exact same problem as @sparksm. So you can see it in the sandbox they provided. When doing an update for a child row, it loses its status as a child node and is moved to the bottom of the grid. We have moved away from data source for now so a workaround is not crucial at this point. Once the server side editing is shipped we will most likely go back to using data source.
Awesome! Then I will let you pros handle it and not get in the way. I'll keep an eye out for it and test it as soon as possible 💪 |
For your information, guys. While looking on a workaround, I have noticed that there is a function
import {useGridPrivateApiContext} from '@mui/x-data-grid/internals';
const gridPrivateApi = useGridPrivateApiContext();
gridPrivateApi.current.updateServerRows([{/*** row object to be updated */}], groupKeys);
|
The server-side data source would accept an optional parameter
updateRow
which would be used to persist the edited rows on the back end.Feel free to upvote to see this feature land faster.
The text was updated successfully, but these errors were encountered: