-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataTable set column to fill #5093
Comments
We found the following entries in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review. This is an automated reply, generated by FAQtory |
I'm currently running into something related to this, if not exactly the same. I want my datatable (placed inside a grid layout) to take up the entirety of the screen width. It does that, but the columns do not: I've tried setting width=None when adding each column but the table is instantiated looking the same. Of course, if I add whitespace in a column name (or insert a row with a particular cell being really long), that particular column resizes accordingly. Then there's the other issue of if the cell is really long, it will make the datatable horizontally scrollable, which is not what I want. In an ideal world, I would instantiate the datatable initially with equal column widths (spanning the entirety of the available horizontal space, but ensuring it does not scroll horizontally), and let the user resize the columns as they see fit, properly saving it so the next time the user opens the application, column sizes are the same as previously set. I understand this would be much too complicated, so the next best thing I can think of is what @gaborbernat said: let all but one column's width adjust to the widest of its cells, and have one column in particular fill the rest of the available width. A good plus would be to ellipsize cell contents that want to go beyond their assigned width limit. EDIT: forgot to mention, yesterday in my troubleshooting I came across this but I don't see any mention in the changelog of this having been implemented (from datatable's default behaviour, even in the examples, it does not appear to have been). |
Discussed in #5092
Originally posted by gaborbernat October 4, 2024
How do I set a column in a data table to take up as much space as left after filling the other columns? Think of a description column that can be long. Ideally, the table would stretch over multiple rows, but if that is not possible to be cut off. I would rather not set a static limit because if the terminal fits in width it should fit as much as possible.
This could be a great feature.
The text was updated successfully, but these errors were encountered: