mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
740 stars 55 forks source link

Automatically adjust column width to length of strings in dataframe #66

Closed Jonas231 closed 2 years ago

Jonas231 commented 2 years ago

Hello, thank you for providing this nice package. I have the following issue: I would like to display a table of a dataframe loaded from an excel table. The first 4 columns have strings which are rather short, while the 5th columns contains lengthier text. How can I adjust the columns' width individually or automatically in itables? grafik

Best regards, Jonas

Jonas231 commented 2 years ago

Hi, I found this solution which works for me: grafik Regards, Jonas

mwouts commented 2 years ago

Hi Jonas,

Thank you for your comments. Yes datatables.net let you adjust the column width individually.

Out of curiosity, what do you get if you remove overall the width in the columnDefs?

I am asking as I am thinking of removing the default value at 70 pixels, cf. #64, this seems to work for my use cases but I'd rather have a confirmation from other users before proceeding.

mwouts commented 2 years ago

I'll close this issue as I believe that the new behavior in itables==0.4.6 (automatic column width by default) improves this use case.

Also the documentation has been updated to give an example of width adjustment for selected columns, as in your screenshot above.