updating columns causes data to be rendered wrong #111
-
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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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 theme = useTheme([ return ( |
Beta Was this translation helpful? Give feedback.
-
I have the same problem but this solution doesn't work for me. I might be doing something wrong. I've created a sandbox https://codesandbox.io/p/sandbox/romantic-gianmarco-nq3nnw The css-var in class applied to the table is updated when I remove columns after I've added them, but the css-var on the style applied on the table is lagging behind. |
Beta Was this translation helpful? Give feedback.
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}
...
/>
)
`