table
table copied to clipboard
Parent columns in groups are not respecting the isVisible value we're passing in
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.
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.
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
)
@KevinVandy Is this a solution you would be open to? If so, would you want me to create the PR for it?
@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.