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

[data grid] Grouped data grid does not remain expanded when removing row #15284

Closed
lucasbachega opened this issue Nov 5, 2024 · 6 comments
Closed
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Row grouping Related to the data grid Row grouping feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@lucasbachega
Copy link

lucasbachega commented Nov 5, 2024

Steps to reproduce

Steps:

  1. Group rows
  2. Expand group
  3. Remove/Edit row
group_expand_problem.mov

Current behavior

No response

Expected behavior

When removing or editing a grouped row, the group should remain expanded.

Context

No response

Your environment

npx @mui/envinfo
 System:
    OS: macOS 14.1.1
  Binaries:
    Node: 20.11.0 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.92
    Edge: Not Found
    Safari: 17.1
  npmPackages:
    @emotion/react: ^11.13.3 => 11.13.3 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/base:  5.0.0-beta.61 
    @mui/core-downloads-tracker:  6.1.6 
    @mui/icons-material: ^6.1.6 => 6.1.6 
    @mui/lab: ^6.0.0-beta.14 => 6.0.0-beta.14 
    @mui/material: ^6.1.6 => 6.1.6 
    @mui/material-pigment-css: ^6.1.6 => 6.1.6 
    @mui/private-theming:  6.1.6 
    @mui/styled-engine:  6.1.6 
    @mui/system:  6.1.6 
    @mui/types:  7.2.19 
    @mui/utils:  6.1.6 
    @mui/x-charts: ^7.22.1 => 7.22.1 
    @mui/x-charts-pro: ^7.0.0-beta.6 => 7.0.0-beta.6 
    @mui/x-charts-vendor:  7.20.0 
    @mui/x-data-grid: ^7.22.1 => 7.22.1 
    @mui/x-data-grid-generator: ^7.22.1 => 7.22.1 
    @mui/x-data-grid-premium: ^7.22.1 => 7.22.1 
    @mui/x-data-grid-pro:  7.22.1 
    @mui/x-date-pickers: ^7.22.1 => 7.22.1 
    @mui/x-date-pickers-pro: ^7.22.1 => 7.22.1 
    @mui/x-internals:  7.21.0 
    @mui/x-license: ^7.21.0 => 7.21.0 
    @pigment-css/nextjs-plugin: ^0.0.21 => 0.0.21 
    @pigment-css/react:  0.0.21 
    @pigment-css/unplugin:  0.0.21 
    @types/react:  18.3.4 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 
    styled-components:  5.3.6 
    typescript:  4.9.5 

Search keywords: group, expand
Order ID: 98639

@lucasbachega lucasbachega added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 5, 2024
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Nov 5, 2024
@michelengelen
Copy link
Member

Hey @lucasbachega ... how are you updating the rows?
You did not provide a reproduction example, so we cannot help you yet.

possibly related issue #13962

@michelengelen michelengelen added status: waiting for author Issue with insufficient information feature: Row grouping Related to the data grid Row grouping feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 6, 2024
@michelengelen michelengelen changed the title Grouped data grid does not remain expanded when removing row [data grid] Grouped data grid does not remain expanded when removing row Nov 6, 2024
@lucasbachega
Copy link
Author

lucasbachega commented Nov 6, 2024

Ei@lucasbachega... como você está atualizando as linhas? Você não viu um exemplo de reprodução, então não podemos ajudá-lo ainda.

possivelmente relacionado ao problema #13962

Sorry. I'm not using apiRef to update a row. I'm just updating an item from the array passed to the DataGrid 'rows' prop. (by state)

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Nov 6, 2024
@michelengelen
Copy link
Member

You should use updateRows from the grid api for this, so the group stays expanded. Updating the rows prop will update all rows and has a rerender of the rows as consequence.

Example:

const removeRow = React.useCallback(() => {
  apiRef.current.updateRows([{ id: 12, _action: 'delete' }]);
}, [apiRef]);

So, the scenario you described is actually expected behavior.

Does this help?

@michelengelen michelengelen added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 6, 2024
@lucasbachega
Copy link
Author

cre

OK I understand. In my case, the table rows are generated from a state in Redux. The component responsible for updating each line is further away in the hierarchy, so I use Redux Toolkit's adapter.updateOne to perform the updates.
Alright then, thanks for your attention.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Nov 6, 2024
@michelengelen
Copy link
Member

Sounds like you can solve your issue now, so I am closing here ... if you still need some help or encounter a related issue please feel free to reopen. 👍🏼

Copy link

github-actions bot commented Nov 7, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@lucasbachega How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Row grouping Related to the data grid Row grouping feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

2 participants