I want horizontal scroll in my table. I have multiple columns and they look like they are stack up together. Any suggestions ?
I think this can be fixed with css classes. Changing:
.react-bootstrap-table table {
table-layout: fixed;
}
TO
.react-bootstrap-table table {
table-layout: auto;
}
or add a class to the component that overrides it when you need it to behave differently than the default.
yeah it works, but I wish it could look better. I tried to center my table and table-layout: auto, but the tables still going to the right.
@theoryfarm thanks your answer. @juancafe4 i think we will not support horizontal scroll in near future. Instead, I'm much interesting to support vertical scroll on table, we have PR working on it but still faced some issue.
Anyway, PR is welcome, I'm also looking forward horizontal scrollable table 馃憤
Sorry to write in a closed issue, but other people like me may be still searching for the answer.
I solved it like follows:
.react-bootstrap-table table {
table-layout: auto;
}
<BootstrapTable
keyField='id'
data={tableData}
columns={columns}
pagination={paginationFactory()}
striped
bordered={false}
wrapperClasses="table-responsive" // This is the style provided by bootstrap 4, this will set the parent div with that class
/>
I hope it helps.
@hielfx, thanks! This worked for me, but I had to add the "react-device-detect" to detect the device and then add the style.
import {isMobile} from 'react-device-detect';
if (isMobile) {
require('../custom-styles/custom.css');
}
.react-inicializa莽茫o-table mesa {
table-layout : auto ;
}
<BootstrapTable
keyField='id'
data={data}
columns={columns}
pagination={paginationFactory()}
wrapperClasses="table-responsive"
/>
Most helpful comment
Sorry to write in a closed issue, but other people like me may be still searching for the answer.
I solved it like follows:
I hope it helps.