class

Opal::UI::Table

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Formatted data table component with column alignment, headers, row selection cursor, windowed scrolling pagination, and cell truncation.

Constructors

new(headers : Array(String) = [] of String, rows : Array(Array(String)) = [] of Array(String), header_fg : Color | Symbol | String | Nil = nil, header_bg : Color | Symbol | String | Nil = nil, border_fg : Color | Symbol | String | Nil = nil, selected_index : Int32 | Nil = nil, visible_rows : Int32 | Nil = nil, scroll_offset : Int32 = 0, truncate : Bool = true, zebra : Bool = false, selected_fg : Color | Symbol | String | Nil = nil, selected_bg : Color | Symbol | String | Nil = nil, zebra_bg : Color | Symbol | String | Nil = nil, cursor_char : String | Nil = nil, divider_char : String | Nil = nil, border_style : Border | Symbol | String | Nil = nil, print_mode : Bool = false)
Source

Class methods

to_string(headers : Array(String), rows : Array(Array(String)), width : Int32 | Nil = nil, zebra : Bool = false, border_style : Border | Symbol | String | Nil = nil, theme : Theme | Nil = nil, color : Bool | Nil = nil) : String

Class convenience method returning styled table string

Source

Instance methods

add_row(cells : Array(String)) : self
Source
border_fg
Source
border_fg=(border_fg : Color | Nil)
Source
border_style
Source
border_style=(border_style : Border | Nil)
Source
cursor_char
Source
cursor_char=(cursor_char : String | Nil)
Source
divider_char
Source
divider_char=(divider_char : String | Nil)
Source
handle_key(key : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
header_bg
Source
header_bg=(header_bg : Color | Nil)
Source
header_fg
Source
header_fg=(header_fg : Color | Nil)
Source
headers
Source
headers=(headers : Array(String))
Source
horizontal_char
Source
horizontal_char=(horizontal_char : Char | Nil)
Source
junction_char
Source
junction_char=(junction_char : Char | Nil)
Source
markdown_mode=(markdown_mode : Bool)
Source
markdown_mode?
Source
move_down(count : Int32 = 1) : self
Source
move_up(count : Int32 = 1) : self
Source
page_down(count : Int32 = 10) : self
Source
page_up(count : Int32 = 10) : self
Source
preferred_print_size(available_w : Int32) : Tuple(Int32, Int32)

Preferred size in print mode: full row height and natural column width

Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
render_print(buffer : Buffer, width : Int32, height : Int32) : Nil

Render hook for one-shot print mode: renders all rows without cursor or scroll clipping

Source
row(cells : Array(String)) : self
Source
rows
Source
rows=(rows : Array(Array(String)))
Source
scroll_offset
Source
scroll_offset=(scroll_offset : Int32)
Source
select(idx : Int32 | Nil) : self
Source
selected_bg
Source
selected_bg=(selected_bg : Color | Nil)
Source
selected_fg
Source
selected_fg=(selected_fg : Color | Nil)
Source
selected_index
Source
selected_index=(selected_index : Int32 | Nil)
Source
truncate=(truncate : Bool)
Source
truncate?
Source
vertical_char
Source
vertical_char=(vertical_char : Char | Nil)
Source
visible_rows
Source
visible_rows=(visible_rows : Int32 | Nil)
Source
zebra=(zebra : Bool)
Source
zebra?
Source
zebra_bg
Source
zebra_bg=(zebra_bg : Color | Nil)
Source