[GH-ISSUE #184] Proportional Table #147

Closed
opened 2026-03-04 01:02:22 +03:00 by kerem · 3 comments
Owner

Originally created by @benpye on GitHub (Nov 18, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/184

It would be great to have the ability to set the width of table columns to be proportionate to the parent size. In some cases keeping all three rows visible is important.

Originally created by @benpye on GitHub (Nov 18, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/184 It would be great to have the ability to set the width of table columns to be proportionate to the parent size. In some cases keeping all three rows visible is important.
kerem closed this issue 2026-03-04 01:02:22 +03:00
Author
Owner

@rivo commented on GitHub (Nov 19, 2018):

tview has this. Please see TableCell.SetExpansion() for details.

Let me know if this is what you're looking for.

<!-- gh-comment-id:439832604 --> @rivo commented on GitHub (Nov 19, 2018): `tview` has this. Please see [`TableCell.SetExpansion()`](https://godoc.org/github.com/rivo/tview#TableCell.SetExpansion) for details. Let me know if this is what you're looking for.
Author
Owner

@benpye commented on GitHub (Nov 19, 2018):

Okay, that sort of works if I use TableCell.SetMaxWidth() also, for example:

results.SetCell(row, 0, tview.NewTableCell("Column A").SetMaxWidth(1).SetExpansion(1))
results.SetCell(row, 1, tview.NewTableCell("Column B").SetMaxWidth(1).SetExpansion(1))
results.SetCell(row, 2, tview.NewTableCell("Column C").SetMaxWidth(1).SetExpansion(1))

This seems to result in each being of equal width.

<!-- gh-comment-id:439995283 --> @benpye commented on GitHub (Nov 19, 2018): Okay, that sort of works if I use `TableCell.SetMaxWidth()` also, for example: ``` results.SetCell(row, 0, tview.NewTableCell("Column A").SetMaxWidth(1).SetExpansion(1)) results.SetCell(row, 1, tview.NewTableCell("Column B").SetMaxWidth(1).SetExpansion(1)) results.SetCell(row, 2, tview.NewTableCell("Column C").SetMaxWidth(1).SetExpansion(1)) ``` This seems to result in each being of equal width.
Author
Owner

@rivo commented on GitHub (Nov 26, 2018):

Yes. If you want all columns to have the same dynamic width, that's the way to do it.

<!-- gh-comment-id:441573160 --> @rivo commented on GitHub (Nov 26, 2018): Yes. If you want all columns to have the same dynamic width, that's the way to do it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#147
No description provided.