koalyptus / TableFilter

A Javascript library making HTML tables filterable and a bit more :)
https://www.tablefilter.com
MIT License
323 stars 95 forks source link

is there a "columns compact" mode? #751

Open sandrotosi opened 4 years ago

sandrotosi commented 4 years ago

Hello, thanks for TableFilter, it's magic :)

i have a webpage showing a table: http://sandrotosi.me/debian/py2removal/index.plain.html which i then converted to use TF: http://sandrotosi.me/debian/py2removal/index.html

i'm wondering if there's a way to have more "compact" columns (and now that i compare the 2 pages side-by-side, even the rows). f.e. "Bug No." is always going to be a 6-character string, but it uses a lot more space than actually needed; and that applies to several other columns too.

it would make it more readable if we can set an option to try and keep the column width as close to the content of that column as possible.

i tried cols_width but that's just a static width, and i'd rather have something dynamic, that ideally would change depending on what sorting you're doing.

thanks for considering!

EDIT: just to make it clear: i want to have the table using the whole width of the browser window, but columns that dont need that much space should be get their width reduced, while others should get enough space to show their cell without wrapping. as i said, i tried cols_width all set to null but that shrinks the whole tables to the minimum, which is not what i want

koalyptus commented 4 years ago

Hi @sandrotosi, have you tried to apply a 100% width to the table and a arbitrary fixed width for the Bug No. column?

sandrotosi commented 4 years ago

tbh, so much time has passed i dont remember all the permutations/attempts i made (the final version of the table configuration is here)

but what i wanted is something that would require me to specify a fixed width, but that would be able to just shrink a column to its minimum required width to contain the data selected by the filter.

if you go to http://sandrotosi.me/debian/py2removal/index.html and enter "yes" in the py3k? column, you see that the string "yes" and the column title are both using more width than necessary, same goes for the columns on the right; but the maintainers column would benefit from additional space to show more value in a single row instead of wrap it up 2/3 times