I’m trying to add a footer to my table but I’d like to see the table footer act like a text_line with text_spans, but in 1.3.x it seems to render as another row in the table. My footer contains pagination data like "Page: 6 Current: 300 Total: 500
Hello and welcome!
When you say it’s rendering as another row in the table, do you mean it isn’t “sticking” to the bottom, is taking on the column layout, and/or is selectable? If so, can you please provide a code sample that reproduces the issue?
For reference, I would expect the table footer to look and behave like the widget_table example, which looks like this snapshot:
┌Processes | Sel: 1 | Offset: auto | Flex: Legacy (Default)────────────────────┐
│ PID Name CPU │
│ 1234 ruby 15.2% │
│> 5678 postgres 8.7% │
│ 9012 nginx 3.1% │
│ 3456 redis 12.4% │
│ 7890 sidekiq 22.8% │
│ 2345 webpack 45.3% │
│ 6789 node 18.9% │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ Total: 7 Total CPU: 126. │
└──────────────────────────────────────────────────────────────────────────────┘
┌Controls──────────────────────────────────────────────────────────────────────┐
│↑/↓: Nav Row ←/→: Nav Col x: Toggle Row (1) q: Quit │
│s: Style (Cyan) p: Spacing (When Selected) y: Symbol (> ) t: Tamp Row │
│+/-: Col Space (1) c: Col Highlight (On) f: Flex Mode (Legacy (Default)) │
│z: Cell Highlight (On) o: Offset Mode (Auto (No Offset)) d: Header (On) │
└──────────────────────────────────────────────────────────────────────────────┘
Oh wow, I just realized the example footer text happens to line up with the columns. I edited it to show text of different length, and I see the problem now.
┌Processes | Sel: 1 | Offset: auto | Flex: Legacy (Default)────────────────────┐
│ PID Name CPU │
│ 1234 ruby 15.2% │
│> 5678 postgres 8.7% │
│ 9012 nginx 3.1% │
│ 3456 redis 12.4% │
│ 7890 sidekiq 22.8% │
│ 2345 webpack 45.3% │
│ 6789 node 18.9% │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ Total pr CPU sum: 126.39 │
└──────────────────────────────────────────────────────────────────────────────┘
┌Controls──────────────────────────────────────────────────────────────────────┐
│↑/↓: Nav Row ←/→: Nav Col x: Toggle Row (1) q: Quit │
│s: Style (Cyan) p: Spacing (When Selected) t: Tamp Row │
│+/-: Col Space (1) c: Col Highlight (On) f: Flex Mode (Legacy (Default)) │
│z: Cell Highlight (On) o: Offset Mode (Auto (No Offset)) d: Header (On) │
└──────────────────────────────────────────────────────────────────────────────┘
diff --git a/examples/widget_table/app.rb b/examples/widget_table/app.rb
index 3256f19..05b285a 100644
--- a/examples/widget_table/app.rb
+++ b/examples/widget_table/app.rb
@@ -156,7 +156,7 @@ class WidgetTable
title: "Processes | Sel: #{selection_label} | Offset: #{offset_label} | Flex: #{flex_mode_entry[:name]}",
borders: :all
),
- footer: ["Total: #{PROCESSES.length}", "Total CPU: #{PROCESSES.sum { |p| p[:cpu] }}%", ""]
+ footer: ["Total processes: #{PROCESSES.length}", "CPU sum: #{PROCESSES.sum { |p| p[:cpu] }}%", ""]
)
# Bottom control panel
It looks like footer-as-row is the behavior from upstream Ratatui. Upstream has merged a column_span feature, but it’s in the unreleased v0.31.0 milestone.
In the mean time, it may be possible to work around this by not using a table footer, and instead simulating it. You may be able to use a vertical Layout for this. If your table has a block: on it, you’ll have to extract that out into a full-fledged Block holding the Layout as a child widget.