-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Sample for re-rendering / partially updating table #156
Comments
Update: looks like you added the (incredibly awesome) Progress since I implemented using a Table; which is a much better fit for my own case. Perhaps some way of rendering borders/etc for Progress to make it look more table-like, since it aldready has columns etc. would be nice. |
I'd actually like examples of this as well and I'd prefer to not be limited to using the Progress feature. I've experimented with calling Is there a canonical example of how to update UIs in-place? 🙏 |
@onionhammer @aclemmensen Updating the UI in-place is kind of out-of-scope for Spectre.Console which isn't a TUI framework, and not something that I plan to support. Sorry. |
Sorry to insist on this topic @patriksvensson, but I want to make sure I didn't get you wrong. |
For the record I think Table should definitely have some way of progressively adding rows; we live in a world of fetching data asynchronously, so not having that ability really limits how/when Tables are used. I respect you're trying to reign in the scope though.. just not sure if that's where I'd personally draw the line given how powerful Progress seems to be. |
@eduherminio @onionhammer It's an easy problem to solve if we only think about the happy path, i.e. update the table, but when it comes to things like supporting re-rendering of tables in terminals that do not support ANSI escape codes or doing cursor updates via ANSI (i.e. GitHub Actions) it gets a bit more complicated. Progress is a fairly simple thing and there are fallback mechanisms in place for these scenarios. I will give it some thought and see if we can solve this problem in a way that's suitable. In the meanwhile, check out this Gist on how to do back buffer rendering in the console. This is the technique I used when creating the table video: https://gist.github.com/patriksvensson/22791f3b413c313e80d4d77c3ff2a2a2 |
@onionhammer This should now be possible to do with the 0.40.0 release. See the |
@patriksvensson looks like a cool update! Is it possible to update the text in an existing row? Or, failing that, to remove a row? In my scenario, I'm counting a bunch of widgets of different types. The different types of widgets are unknown. I'd like to display live information as I count the different widgets. For example, after the first pass, I might have 18 foos, and 7 bars. After the next pass, I'll have a total of 25 foos, 19 bars, and 3 baz. So then I'd like to update the counts and add the new row. I was thinking of doing this in a live table but perhaps a different approach would work better. |
If I were you, I would probably use a live display, but instead of updating individual parts, which is difficult since table rows are immutable (by design and good reasons), I would probably regenerate the whole table and call |
@patriksvensson works great, although the method is |
@HolisticDeveloper Yes, should be able to now. Sorry for forgetting to update this issue! |
Hi! I want to display a table with values that continually update, it would be nice to have an 'idiomatic'/documented way of doing this (apologies if this is documented somewhere, I didnt find it)
I'm currently doing this by building a new Table() for every re-render, and clearing the whole buffer every time. Is this the only way?
The text was updated successfully, but these errors were encountered: