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: 1 comment
-
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 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}
...
/>
)
`