I created a table using RSuite Table and trying to fix few columns to the left of the table when scrolled right as my table has many columns. However the columns are not staying in the view
<Table data={rows} height={700} virtualized onRowClick={data => { console.log(data) }}>
{
columns.map((value, index) => {
if (value.fixed) {
return <Column width={value.width} fixed="left">
<HeaderCell>{value.name}</HeaderCell>
<Cell dataKey={value.key} />
</Column>
} else {
return <Column width={value.width}>
<HeaderCell>{value.name}</HeaderCell>
<Cell dataKey={value.key} />
</Column>
}
})
}
</Table>
My colums as initialized as follows.
let columns = [
{ key: 'date', name: 'date', width: 100, fixed: 'left' },
{ key: 'productId', name: 'Product Id', width: 120, fixed: 'left' },
{ key: 'country', name: 'Country', width: 120, fixed: 'left' }
]
Object.keys(EXTRA_COLUMNS).forEach(factor => {
columns.push({ key: factor, name: factor, width: factor.length * 10 })
});
this.setState({ columns: columns, rows: data.rows, rowCount: this.state.rowCount + data.rows.length, loading: loading });
The data in all the columns is loading just fine. Only issue is the first 3 columns that were supposed to be frozen, are not staying frozen. I have tried just using <Column width={value.width} fixed>
and also debugged and reaching the breakpoint of the part inside if(value.fixed)
for the first 3 columns, but no luck with freezing columns.
Any idea how to fix this?