Skip to content

How to set target height of a table? #188

Open
@hemanth2004

Description

@hemanth2004

I want to display a bubble-table as a sub-section of my entire terminal UI layout. The problem is that when multi-line is enabled, contents of a cell overflow into the next line, causing the entire table to increase its height by 1, which in turn breaks the layout.

I've tried-

  1. WithMinimumHeight(): Even with minimum height set, the lines that overflow don't look like they're being taken into account when calculating table height in terms of lines.
  2. WithPageSize(): Seems to be purely about number of table records, i.e. number of rows instead of about the number of terminal lines

Currently, I use a very hacky and convoluted solution where I calculate the width of a column, then using the contents of my table, I calculate the number of overflow lines in each cell, eventually calculating the max overflow in each row. I sum up all the overflowing lines and subtract my input to WithMinimumHeight() by that much.
And with the help of WithPageSize(), I set my number of rows to half of the target height of that section of my layout.

It looks kinda wonky and has some extra space in each page, but it works for now as multiline is essential to my project.
I am now looking into making my table horizontally scrollable instead of using multiline.

This is just a post asking whether if there is some hidden way to set my target height in terms of number of lines, else this can be considered a feature request.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions