Column Resizing
Is there a feature for resizing columns?
@mikeerickson, this issue is duplicated with #187. And I hope to support this feature in future. But There's no schedule, because I have another bugs or features need to do.
PR is welcome :+1:
Thanks :)
Thanks for quick reply, greatly appreciated. I have forked repo and will have a look. I have implemented resizing on default tables.
@mikeerickson, that's awesome, it's hard to implement, because the column with on bootstrap table is hard to control(include, resizing and different browser etc.)
Anyway, I'm glad that you can give any contribution :)
No worries! I have internal vested interest, so the time allotted will be justified. I will begin on this in the morning.
Really Thanks :)
+1
Looking forward to it 👍
@mikeerickson any updates on this?
Any updates?? Need Help
There are two PR is opend, but still have some issue we need to solve firstly and I also want to find a best solution for resizing. Sorry for I can't give any promise for when I can got this job done.
hi,
somehow i managed the resizing with jquery resize plugin.. in componentDidMount i wrote this.. for every column seperately.. i know its not a very clean approach, but it works
componentDidMount:function(){
$(".table-header .table th:eq(2)" ).resizable({
minWidth: 28,
alsoResize: ".table-container .table th:eq(2), .table-container .table td:eq(2)"});
$(".table-header .table th:eq(3)" ).resizable({
minWidth: 28,
alsoResize: ".table-container .table th:eq(3), .table-container .table td:eq(3)"});
$(".table-header .table th:eq(5)" ).resizable({
minWidth: 28,
alsoResize: ".table-container .table th:eq(5), .table-container .table td:eq(5)"});
},
and so on for 8 columns..
For other folks trying to do this: I used ssjogus's approach with jquery-ui resizable, however, it didn't worked well, e.g. when data are loaded after resizing column, column's width was reseted. I made it work by storing column width in state via resize callback:
$(".table-header .table th:eq(2)" ).resizable({
minWidth: 28,
handles: 'e',
resize: (event, ui) => {
this.setState({ columnWidth: ui.size.width });
}
});
and using this as width prop for column element:
<TableHeaderColumn
dataField="starts_at"
width={`${this.state.width}px`}
>...
Another advantage of holding column width in state is that you may e.g. store widths in cookies to remember them for next session.
Still, this is just a hack to make it work and I am also looking forward to resizable columns being native feature of react-bootstrap-table
react-bootstrap-table already stop develop new feature and move to react-bootstrap-table2. we will consider to implement resize feature in react-bootstrap-table2 thanks
hey @MichalRemis I couldn't get your solution to work :(, is table-header CSS class something you've defined yourself?
Can some one please share column resizing example.
Is there a solution to this issue?
Ok guys I made JSFiddle example of my approach with jquery-ui resizable (dont forget to include jquery,jquery-ui and also jquery-ui-css). You store widths of columns in the state (nice side effect is that you may e.g. store widths in cookies to remember them between refreshes). I can became tricky when using horizontal scrollbar, but is is doable by tweaking styles/widths.
https://jsfiddle.net/1s8reLw1/14/
is the column resizing feature available now in react-bootstrap-table-next ?
https://codesandbox.io/s/react-bootstrap-resizable-column-znqj8
Resizable Colum for react-bootstrap