class RatatuiRuby::TableState
Mutable state object for Table widgets.
When using {Frame#render_stateful_widget}, the State object is the *single source of truth* for selection and scroll offset. Widget properties (selected_row, selected_column, offset) are ignored in stateful mode.
Example
@table_state = RatatuiRuby::TableState.new @table_state.select(1) # Select second row @table_state.select_column(0) # Select first column RatatuiRuby.draw do |frame| table = RatatuiRuby::Table.new(rows: [...], widths: [...]) frame.render_stateful_widget(table, frame.area, @table_state) end
Public Instance Methods
Source
# File lib/ratatui_ruby/table_state.rb, line 27
Creates a new TableState with optional initial row selection.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 67
Returns the current scroll offset.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 75
Scrolls down by n rows.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 83
Scrolls up by n rows.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 35
Sets the selected row index. Pass nil to deselect.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 51
Sets the selected column index. Pass nil to deselect.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 43
Returns the currently selected row index.
(Native method implemented in Rust)
Source
# File lib/ratatui_ruby/table_state.rb, line 59
Returns the currently selected column index.
(Native method implemented in Rust)