-
-
Notifications
You must be signed in to change notification settings - Fork 51
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?
I have explained the issue here: updating columns causes data to be rendered wrong in react table library
Beta Was this translation helpful? Give feedback.
All reactions
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
-
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}
...
/>
)
`
Beta Was this translation helpful? Give feedback.