Description
First of all, thank you for the great effort, I've been using RDT at work for a while now, so again, thank you.
Describe the bug
when I enable fixedHeader
the table body is set to have overflow-y: scroll
, which will always show the vertical scrollbar, this is a correct behavior, however, this causes the content width of the header row to be larger than the content width of body rows, this happens because the scrollbar is taking up space from the table body row as well.
this starts to be a problem if I have grow: '1'
on some of my columns, which means we now have column's with dynamic width, but now the width of the column head is no longer equal to the cells width under the same column, because again, the overall width of the header row is larger than the width of the body row.
this whole issue can be simply solved by adding padding-right: SCROLLBAR_WIDTH
to the header row.
To Reproduce
Steps to reproduce the behavior:
- add columns with
width
only, and others withminWidth
andgrow
, and havefixedHeader
enabled - fill the headers with any data, and do the same for the body
- notice how the columns with dynamic width are not aligning correctly with the body below them
Expected behavior
I expect each column header to align correctly with the cells in the body that are under the same column
Code Sandbox
https://codesandbox.io/s/react-data-table-sandbox-2m8l9
Screenshots
1)
2)
3)
Versions
- React: 16.8.6
- Styled Components: 4.4.0
- OS: windows 10
- Browser: Chrome
- Version: 79.0.3945.88