table icon indicating copy to clipboard operation
table copied to clipboard

horizontal scroll

Open danmolitor opened this issue 9 years ago • 5 comments

Hi there,

I've looked through the props and issues, and I could just be missing something. Is there a way to set a width and overflow for the table so that the table can be scrollable horizontally, or will I have to do that with CSS?

Thanks.

danmolitor avatar Nov 27 '17 19:11 danmolitor

The columns autosize to fit the width. If you size the columns beyond what can fit, the horizontal scroll will automatically be enabled. The table is designed to be "responsive" and does not support setting a horizontal width. However, each column allows for a width property - which you could set to various amounts that would cause the scroll to kick in.

Please also consider joining the #react-table Slack channel (badge in the README in the doco) as the github issues are for broken code or feature requests. Thanks.

gary-menzel avatar Nov 28 '17 01:11 gary-menzel

See https://codesandbox.io/s/oo9j4z1139 for my implementation of the horizontal scroll.

oscarvdl avatar May 17 '18 14:05 oscarvdl

I have the same problem and spent a lot of time doing it. So I just wrapped a table to a div and set for div max-width: 100%; overflow-x: auto; I think it’s not actually for you now, but maybe somebody will have the same question

AntonDeXy avatar Feb 07 '21 22:02 AntonDeXy

Thanks @AntonDeXy ,

<div style={{ maxWidth: '100%', overflowX: 'auto' }}>
              <table {...getTableProps()}> ........  </table>
</div>

SomnathKadam avatar Jun 15 '22 16:06 SomnathKadam

However, when we attempted to use that, no dropdown menu opened. How can we fix this?

anish-sarvadhi avatar Apr 02 '24 11:04 anish-sarvadhi