Reputation: 430
I'm using "react-bootstrap-table" for rendering table. Some of column has long text where getting elipsis. I have set width="some numbers". I want to set width as dynamic or column should take with as per text's length. Is theren any way to set width auto without calculating text length or can we wrap the text and remove the elipsis ?
Here is my code
<BootstrapTable
data={products}
pagination
options={options}
striped
hover
search
>
<TableHeaderColumn width="170" dataField="a1" dataSort columnTitle>some text</TableHeaderColumn>
// Here i have set widht manually as ' width="160" '
<TableHeaderColumn width="160" dataField="a2" dataSort columnTitle>some text</TableHeaderColumn>
<TableHeaderColumn width="140" dataField="a3" dataSort>some text</TableHeaderColumn>
</BootstrapTable>
Upvotes: 0
Views: 20169
Reputation: 4748
You can just specify some width and use tdStyle
to achieve what you want:
<TableHeaderColumn
dataField='name'
width="200"
tdStyle={{ whiteSpace: 'normal', wordWrap: 'break-word' }}
>
Product Name
</TableHeaderColumn>
Upvotes: 7