I am using https://react-table.js.org/#/story/readme for displaying table from server response. But for column data with long length, its showing ellipsis. I am not finding a way for wrapping it, so that full data is displayed.
In the doc, they have mentioned style
prop, but I am not able to figure it out. I tried below, but it did not work.
<ReactTable
data={respDataArr}
columns={columns}
style={{overflow:'wrap'}}
/>
Can someone suggest please what change should I do?
Wrap Text Around a Table in Word. Right-click on the table and select “Table Properties.” In the Table tab, select the “Around” option. Adjust the wrapping by dragging and dropping the table, or by clicking “Positioning” in Table Properties.
CSS word-wrap property is used to break the long words and wrap onto the next line. This property is used to prevent overflow when an unbreakable string is too long to fit in the containing box.
Frozen Rows and Columns (React) You can freeze rows and columns by setting the grid's frozenRows and frozenColumns properties. Frozen cells do not scroll but are selectable and editable like regular cells.
You'll want to use the css property white-space: unset;
find the column you want to have wrap text and add the following as a property of the column
// Example Column definition
{
Header: 'header',
accessor: 'data1',
style: { 'whiteSpace': 'unset' } //Add this line to the column definition
}
Alternatively you can add a class that targets .ReactTable .rt-td
directly in your css/sass/scss
Edited: Added example column definition to make it clearer, updated to new react-table api
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With