How to set exact width of columns in react-table version 8 which will not change in any condition

841 Views Asked by At

I'm using a table with an expand option while working on a react table. With react table version 7, which I used to make this table, I was able to adjust the width of each table column using the width property and the useBlockLayout hook. Now I'm switching to react-table version 8, or tan table, for performance reasons.

In version 8, I can create a table with the expand option and also set the width using the size option, but whatever size I enter is not applied exactly to columns. For example, if I enter 118 as size, it takes 120 or 110 in pixels. Additionally, if I click the expand all button and the size of the first column changes, it reduces the size of other columns.

Any width I specify in the older version appears to be applied to the table, and columns' sizes are preserved if the size of an outer contained window changes.

In conclusion, I want to give the table fixed column sizes that shouldn't alter under any circumstances.

  1. My implementation of react table version 7 with expand option and fixed columns width. React table in version 7 with fixed column width

  2. My implementation of react table version 8 with expand option and variable columns width Link to my implementation

In First implementation I have set width and that exact width is applied in version 7.

But in version 8 of table given size is not applied to column table. And my constraint is I don't want to increase the width and height of table Container Class which is holding this table

Please refer both the implementation of mine and please tell me what is I am missing in tan table implementation because of that it is not maintaining the width of column

0

There are 0 best solutions below