Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

updating columns causes data to be rendered wrong #111

Answered by dandelionn
dandelionn asked this question in Q&A
Discussion options

Hello! If I create a table with 3 columns and then I modify the columns to 6 and after that I switch back to 3 columns the table still renders 6 columns. How can I fix this?
I have explained the issue here: updating columns causes data to be rendered wrong in react table library

You must be logged in to vote

I have found out that I need to modify this css variable: "--data-table-library_grid-template-columns" depending on how many columns I want to display,
const columnsCount = 6; getTableTheme = (columns) => { return
--data-table-library_grid-template-columns: repeat(${columns}, minmax(0px, 1fr))
`;
}

const theme = useTheme([
getTheme(),
{
Table: getTableTheme(columnsCount),
...customTheme
},
]);

return (
<CompactTable
theme={theme}
...
/>
)
`

Replies: 1 comment

Comment options

I have found out that I need to modify this css variable: "--data-table-library_grid-template-columns" depending on how many columns I want to display,
const columnsCount = 6; getTableTheme = (columns) => { return
--data-table-library_grid-template-columns: repeat(${columns}, minmax(0px, 1fr))
`;
}

const theme = useTheme([
getTheme(),
{
Table: getTableTheme(columnsCount),
...customTheme
},
]);

return (
<CompactTable
theme={theme}
...
/>
)
`

You must be logged in to vote
0 replies
Answer selected by dandelionn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /