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

Parent columns in groups are not respecting the isVisible value we're passing in #5770

Open
mattprice09 opened this issue Oct 3, 2024 · 4 comments

Comments

@mattprice09
Copy link

mattprice09 commented Oct 3, 2024

I believe this PR is the root cause.

We upgraded our @tanstack/react-table library from 8.9.3 to 8.20.5. Prior to this change, our header column parents were being hidden by us setting column visibility of the header column parents to false. We DO want the children columns to show, even when the parent columns are set to false. After making the upgrade to 8.20.5, the parent columns are showing, even though we are setting the column visibility to false.

Is there any way we can revert this PR, assuming it is the root cause here? To reiterate, we do not want parent column headers to show just because a child column is showing.

@KevinVandy
Copy link
Member

Hmmm, I think the fixed functionality is what actually makes sense here. You don't have to use this API if you want to check something else.

@mattprice09
Copy link
Author

mattprice09 commented Oct 3, 2024

Hmmm, I think the fixed functionality is what actually makes sense here. You don't have to use this API if you want to check something else.

@KevinVandy I agree that it makes sense to look at children column visibility for the fallback value, but IMO it would be ideal if the logic respected the assigned visibility state of the column. For example:

    column.getIsVisible = () => {
      return table.getState().columnVisibility?.[column.id] ?? true
      const childColumns = column.columns
      const columnHasVisibilitySpecified = !((table.getState().columnVisibility?.[column.id]) === undefined || table.getState().columnVisibility?.[column.id] === null));
      return (
         columnHasVisibilityAssigned
         ? table.getState().columnVisibility?.[column.id])
         : childColumns.length
           ? childColumns.some(c => c.getIsVisible()) : table.getState().columnVisibility?.[column.id])
           : true
      )

@mattprice09
Copy link
Author

@KevinVandy Is this a solution you would be open to? If so, would you want me to create the PR for it?

@KevinVandy
Copy link
Member

@KevinVandy Is this a solution you would be open to? If so, would you want me to create the PR for it?

Only in the alpha. Want to limit breaking changes in main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants