plotly / dash-table-experiments

NO LONGER SUPPORTED - use https://github.com/plotly/dash-table instead
MIT License
174 stars 57 forks source link

datatable: introduce auto-width flag #98

Closed couture-ql closed 5 years ago

couture-ql commented 5 years ago

Currently, DataTable provides a way for users to define column widths, which is useful for flexibility. However, when tables and pre-set columns do not match up perfectly, the last column can fall short of the calculated width of the table viewport. Adding a new flag to allow callers to skip setting the fixed width of the last column, such that it will be calculated by react-table-grid instead, allowing it to be a sane width.

Fixes an issue where setting fixed widths may cause last item to fall short of calculated container.

Signed-off-by: Jamie Couture jamie@quandl.com

couture-ql commented 5 years ago

It may be useful to skip setting the last cell width to allow react-table-grid to do the calculation for us. See attached before and after:

out

I did not want to introduce a feature that does something people may not expect -- the last column to always be the size they specified. Instead, introduce a new knob allowing callers to explicitly request to let the last column size to be calculated by react-table-grid. Technically, users can avoid this 'issue' by defining n-1 column widths, and the last item will be calculated by react-table-grid. However, if users want or need to define the same number of widths as there are columns, adding a knob might be helpful to specify the desired behaviour.

bpostlethwaite commented 5 years ago

Thanks for the feedback @couture-ql

Please note that this repo is deprecated in favour of https://github.com/plotly/dash-table

Bad news is that we won't be fixing issues in this component. The good news is that the new dash-table is much much better!

couture-ql commented 5 years ago

Oh cool. Good to know, and will try to switch over asap.

couture-ql commented 5 years ago

Since this project is deprecated the suggested fix is useful only for historical reasons.