refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
25.95k stars 1.96k forks source link

feat(mui): editable Data Grid #5744 #5989

Closed lnikitadobrenkol closed 1 week ago

lnikitadobrenkol commented 1 month ago

Bugs / Features

This PR introduces the ability to make MUI Data Grid columns editable by setting an editable property on specific column definitions.

What is the current behavior?

Currently, the MUI Data Grid does not support inline editing directly through configuration.

What is the new behavior?

With the changes in this PR, developers can now configure columns to be editable directly from the MUI Data Grid setup, enhancing the grid's flexibility for various use cases.

fixes # (5656)

Notes for reviewers

I have extensively tested the functionality introduced in this PR, primarily based on the initial implementation by @beg1c. After setting up a test project to integrate the enhanced dataGridHook, it has met the expected outcomes. I encourage a thorough review to ensure that all aspects of the new editable feature align with our project standards and user requirements. Please provide feedback or suggest improvements if you identify potential enhancements or adjustments. I am open to discussions and willing to make any necessary changes to perfect this feature.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 8cb1394a7da1b0a1f87098c02b8b718e31bf6b93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | --------------- | ----- | | @refinedev/mui | Minor | | @refinedev/core | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

lnikitadobrenkol commented 1 month ago

Hello @aliemir I've been working on enhancing the useDataGrid hook to handle errors and state more robustly, specifically around reverting to original data when updates fail. However, I’m stuck with an issue where, despite the update operation being rejected (we simulate this in tests), the function still returns the modified data instead of the original.

Here’s the quick rundown: Function: processRowUpdate Expected: Return old data on update failure. Actual: It returns the new, incorrect data.

I’ve spent quite a few hours on this and tried various fixes, but no luck so far. Could you please help me with this – any commits, examples, ideas or suggestions would be greatly appreciated! We can arrange a short call if needed - so I can share the screen to show what exactly I am doing, (maybe I completely on the wrong direction)

lnikitadobrenkol commented 1 month ago

@BatuhanW @aliemir Hey guys! I need your help in implementing useUpdate. Please have a look

aliemir commented 1 month ago

Hey @lnikitadobrenkol i'll try to check your comment today and get back to you 🙏

lnikitadobrenkol commented 1 month ago

Hi @aliemir, I think I was finally able to resolve the issue and updated the PR :space_invader:! Please review the latest commit and let me know if further adjustments are needed. I would appreciate your feedback to ensure everything meets the standards. And I would need a help with the cypress end-to-end test for sure, I have almost no experience writing them

lnikitadobrenkol commented 4 weeks ago

@aliemir Thank you for the detailed review!! It really helps, appreciate it. Sure, I'll have a look at the comments and commit the fix as soon as possible for me

lnikitadobrenkol commented 4 weeks ago

@aliemir I updated the PR based on your feedback. Please have a look and and let me know if we can proceed or more changes are required

lnikitadobrenkol commented 3 weeks ago

@aliemir @BatuhanW @omeraplak Hey guys! I think I found the way to fix cypress e2e tests, just made the commit. Could you please review the PR - and let's fix any problem that are left, and proceed with this issue further?

lnikitadobrenkol commented 3 weeks ago

Thank you! I'll have a look at the comments and work on the fix this week. Sure, please let me know how you find this feature locally and if there is anything we can improve

lnikitadobrenkol commented 2 weeks ago

@aliemir hello! I implemented the changes you suggested, please have a look

lnikitadobrenkol commented 2 weeks ago

Hey @aliemir! No, it was not intentional - I guess I missed it somehow. Thank you for spotting it, and doing other updates - looks great!

lnikitadobrenkol commented 2 weeks ago

@aliemir What do you think - are we ready to merge the PR or there is something else left to work on?

lnikitadobrenkol commented 2 weeks ago

@aliemir @BatuhanW Could you please review this PR whenever it's convenient for you and let me know if it's ready to be merged? I'd love to include this feature in the July release. I'll be on vacation from June 22-29, so if any changes are needed, it would be great to address them this week.

aliemir commented 1 week ago

Hey @lnikitadobrenkol We'll merge this PR to be included in our next release. In the context of this feature, we don't require any additional changes, thank you for your contribution 🙏