Skip to main content

Module table_view

Module table_view 

Source
Expand description

TableView<T> — generic, virtualized, accessible tabular widget.

Built atop the ListModel<T> / ListDataSource data layer in teksilo-data and the teksilo-tokens TableStyle. Mirrors Qt’s QTableView, SwiftUI’s Table, and JavaFX’s TableView. The core skeleton: single body pane, row-virtualized with alternating backgrounds, grid lines, Role::Table > Role::Row > Role::Cell accessibility, multi-row selection, and an empty-state slot. Headers, sort, filter, resize, reorder, pinning, cell selection, and editing are also included. Row heights come in three modes: uniform (row_height, the default fast path), exact per-row callback (row_height_fn), and auto-measured (auto_row_height — rows grow to their tallest cell, height-for-width). See docs/table-view.md “Row heights”.

use teksilo_data::ListModel;
use teksilo_widgets::table_view::{Column, ColumnWidth, TableView};
use teksilo_i18n::lit;

struct Person { name: String, age: u32 }

let model: ListModel<Person> = ListModel::new();
let _table = TableView::new(model)
    .add_column(Column::new("name", ColumnWidth::Flex(1.0))
        .label(lit!("Name"))
        .cell(|p: &Person, _cx| Box::new(
            teksilo_widgets::primitives::TextWidget::new(
                teksilo_i18n::lit!(p.name.clone())
            )
        )))
    .add_column(Column::new("age", ColumnWidth::Fixed(60.0))
        .label(lit!("Age"))
        .cell(|p: &Person, _cx| Box::new(
            teksilo_widgets::primitives::TextWidget::new(
                teksilo_i18n::lit!(p.age.to_string())
            )
        )))
    .alternating_rows(true)
    .row_height(32.0);

Re-exports§

pub use self::column::Alignment;
pub use self::column::CellContext;
pub use self::column::Column;
pub use self::column::ColumnContext;
pub use self::column::ColumnResizePolicy;
pub use self::column::ColumnWidth;
pub use self::column::EditTriggers;
pub use self::column::GridLines;
pub use self::column::PinnedSide;
pub use self::column::TabTraversal;
pub use self::column::TruncationPolicy;
pub use self::selection::CellSelectionModel;
pub use self::selection::TableSelectionMode;

Modules§

a11y
Accessibility wrappers for TableView / TreeTableView.
body
Per-row container widget — Role::Row, lays its cells horizontally using a shared column-width handle owned by the parent table.
body_pane
BodyPane<T> — the virtualized row pane underneath the header.
column
Column descriptor + supporting enums for TableView and TreeTableView.
filter
Per-column filter popover UI.
header
Sticky header strip + per-column header cells.
imperative
Imperative-API helpers shared by TableView and TreeTableView.
keyboard
Shared keyboard handler for TableView and TreeTableView.
layout
Column-width resolution + per-pane horizontal layout.
row_navigator
Trait abstracting per-row navigation for TableView and TreeTableView.
selection
Selection types for TableView and TreeTableView.

Structs§

TableView
Generic, virtualized, accessible table with sortable / filterable / resizable columns.

Enums§

SortDirection
Sort direction emitted by TableView / TreeTableView headers and consumed by sort projections.