TableModel class

Table model for interactive tables.

Features:

  • Row selection with keyboard navigation
  • Page up/down scrolling
  • Configurable columns and styles
  • Viewport scrolling for large tables

Example:

final table = TableModel(
  columns: [
    Column(title: 'ID', width: 5),
    Column(title: 'Name', width: 20),
    Column(title: 'Status', width: 10),
  ],
  rows: [
    ['1', 'Alice', 'Active'],
    ['2', 'Bob', 'Inactive'],
  ],
);
Inheritance

Constructors

TableModel({List<Column>? columns, List<Row>? rows, int? height, int? width, bool focused = false, TableKeyMap? keyMap, TableStyles? styles, HelpModel? help})
Creates a new table model.

Properties

columns ↔ List<Column>
Gets the columns.
getter/setter pair
cursor ↔ int
Gets the cursor position.
getter/setter pair
focused → bool
Whether the table is focused.
no setter
hashCode → int
The hash code for this object.
no setterinherited
height → int
Gets the viewport height.
no setter
help ↔ HelpModel
Help model.
getter/setter pair
keyMap ↔ TableKeyMap
Key bindings.
getter/setter pair
rows ↔ List<Row>
Gets the rows.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedRow → Row?
Gets the selected row, or null if none.
no setter
styles ↔ TableStyles
Table styles.
getter/setter pair
width → int
Gets the viewport width.
no setter

Methods

blur() → void
Blur the table.
focus() → void
Focus the table.
fromValues(String value, String separator) → void
Load rows from a string value.
getColumns() → List<Column>
Returns the columns (parity with bubbles).
getCursor() → int
Returns the current cursor position (parity with bubbles).
getRows() → List<Row>
Returns the rows (parity with bubbles).
gotoBottom() → void
Move selection to last row.
gotoTop() → void
Move selection to first row.
helpView() → String
Returns the help view for the keymap.
init() → Cmd?
Returns an optional command to execute on program startup.
override
moveDown(int n) → void
Move selection down by n rows.
moveUp(int n) → void
Move selection up by n rows.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setColumns(List<Column> c) → void
Sets the columns (parity with bubbles).
setCursor(int n) → void
Sets the cursor position (parity with bubbles).
setHeight(int h) → void
Set the height of the table.
setRows(List<Row> r) → void
Sets the rows (parity with bubbles).
setStyles(TableStyles s) → void
setWidth(int w) → void
Set the width of the table.
toString() → String
A string representation of this object.
inherited
update(Msg msg) → (TableModel, Cmd?)
Updates the component state in response to a message.
override
updateViewport() → void
Update the viewport content.
view() → String
Renders the current model state for display.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited