Replies: 1 comment 1 reply
-
This is really an application for Textual. Rich renderables aren't really aware of height, there is no easy way to fit a table to the height of the terminal. The The API is not too different from Rich Table, so I'm sure you could get up and running quickly. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a few use cases where I need to browse large amounts of tabular data. They are provided by a REST API with pagination.
Rendering the entire data set into a
Table
via aPager
is not practical, as this would require loading all data upfront, would take a very long time to render, and the user won't see anything until everything is loaded and rendered.Currently I load and display the data one (API) page at a time using a
Live
display. Then I wait for the user to press a key before proceeding to the next page. This works reasonably as long as one row of data renders as one line on screen (or at least a fixed number of lines). I can just request as many rows from the API as there are lines on the screen (minus room headers etc.) But if the row height varies, this doesn't work well – if I request too many rows, some data are cut off. If I don't request enough rows, there is empty unused space below the table.I think this can be solved, but it requires a lot of bookkeeping and caching of already retrieved rows, and an efficient means to determine how many rows fit into the available screen space (a naive algorithm that just fills the table row by row and measures its height each time would have O(n²) performance. In a quick test, it started to feel slightly sluggish at about 20 rows). Therefore I believe this would be best done as a reusable component.
I'm thinking of creating such a component, but I have been wondering where it should go:
DataTable
. However,DataTable
is not the same as a RichTable
. Also, I'm not familiar with Textual.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions