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] gridFilteredDescendantCountLookupSelector counts a group as a row #14268

Closed
ashburnham opened this issue Aug 20, 2024 · 10 comments
Closed
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@ashburnham
Copy link

ashburnham commented Aug 20, 2024

Steps to reproduce

Link to live example:

https://home.hirespace.com/events/16bf1c64-8845-4aa0-befd-824dc6784f37/proposal/list-view/53a360a6-7df9-4b40-b5bb-1a7767b19b5d/pricing

Steps:

  1. Create a data table with nested groups
  2. Use gridFilteredDescendantCountLookupSelector in your code
  3. See that gridFilteredDescendantCountLookupSelector overcounts the descendants.

Current behavior

if you have a parent group which has two rows inside that are in the same group, then it will count this as 3 descendants (it counts the 2 rows and then adds another for the group).

This is confusing for the user who only sees 2 descendant rows which just happen to be grouped.

Expected behavior

if you have a parent group which has two rows inside that are in the same group, then it should count this as 2 descendants because there are only 2 descendant rows.

Context

I want to show nested grouped rows to my users. I want to show how many rows are in each group. This is currently not possible.

Your environment

npx @mui/envinfo System: OS: macOS 14.3 Binaries: Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node npm: 10.8.1 - ~/Documents/code/v2/hs-suite/node_modules/.bin/npm pnpm: Not Found Browsers: Chrome: 127.0.6533.120 Edge: Not Found Safari: 17.3 npmPackages: @emotion/react: 11.11.3 @emotion/styled: 11.11.0 @mui/base: 5.0.0-beta.29 @mui/core-downloads-tracker: 5.15.20 @mui/icons-material: 5.15.2 @mui/lab: 5.0.0-alpha.158 @mui/material: ^5.15.20 => 5.15.20 @mui/private-theming: 5.15.20 @mui/styled-engine: 5.15.14 @mui/system: 5.15.20 @mui/types: 7.2.14 @mui/utils: ^5.14.5 => 5.15.20 @mui/x-data-grid: 6.18.6 @mui/x-date-pickers: 6.19.6 @mui/x-license: 7.7.1 @types/react: 18.0.31 => 18.0.31 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.4.5 => 5.4.5

I'm using latest chrome.

Search keywords: gridFilteredDescendantCountLookupSelector
Order ID: 92825

@ashburnham ashburnham added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 20, 2024
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Aug 20, 2024
@svidskiy
Copy link

[Offtopic] You put your license key, not the order id

@michelengelen
Copy link
Member

[Offtopic] You put your license key, not the order id

Thanks @svidskiy ... I replaced it with the order id and removed the entry from the revision! 👍🏼

@michelengelen michelengelen added the support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/ label Aug 20, 2024
@michelengelen
Copy link
Member

@ashburnham Just to clarify: Are you using Row Grouping or Tree Data?

@michelengelen michelengelen changed the title gridFilteredDescendantCountLookupSelector counts a group as a row [data grid] gridFilteredDescendantCountLookupSelector counts a group as a row Aug 20, 2024
@ashburnham
Copy link
Author

Hi Michele, I'm using tree data

@michelengelen
Copy link
Member

In a tree data structure, a group node is any node with children. Every group node is a descendant of its parent because of the hierarchical nature.

Example:

Consider the following tree:

        A
       / \
      B   C
     / \
    D   E
  • Node A is the root.
  • Node B is a group node (it has children D and E).

Why B is a Descendant of A:

  • Parent-Child Relationship: Node B is directly connected to Node A, making A the parent of B.
  • Descendant Definition: Since there's a direct path from A to B, Node B is a descendant of Node A.

In this hierarchy, B is a group node because it has children (D and E), and it's also a descendant of its parent, A.

Therefore Node A has a total of 5 descendants.

This is a representation of the same data in a flat version:

Flat Data Grid with Paths:

Node Parent Path
A None A
B A A > B
C A A > C
D B A > B > D
E B A > B > E

Does that clear it up for you?

@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 Aug 20, 2024
@ashburnham
Copy link
Author

ashburnham commented Aug 22, 2024 via email

@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 Aug 22, 2024
@michelengelen
Copy link
Member

IMHO this is the way this feature should work. There is one thing that is easily misunderstood here: The group node B is still a valid descendant of A and should therefor be counted towards the descendant count.

Thats why I added the flat representation as well i my last comment:

Flat Data Grid with Paths:

Node Parent Path
A None A
B A A > B
C A A > C
D B A > B > D
E B A > B > E

As you can see here without the tree data grouping B is still a valid row.

Depending on your needs you should probably consider using the Row grouping feature instead.

@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 Aug 22, 2024
Copy link

The issue has been inactive for 7 days and has been automatically closed.

@ashburnham
Copy link
Author

agree this is not a bug, but it is still required so have opened feature request
#14491

@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 Sep 5, 2024
@github-actions github-actions bot reopened this Sep 5, 2024
@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 5, 2024
@michelengelen michelengelen closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 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.

@ashburnham: 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.

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! support: pro standard Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

3 participants