Skip to main content

Module data_table

Module data_table 

Expand description

DataTable primitive — sortable, resizable, virtualized tabular view.

Sort is non-destructive: rows stay in insertion order and an index view carries the display order, so DataTable::sort_by_with can re-apply the remembered comparator whenever local rows change. DataTable::from_model instead delegates order and paging to TableModel. Its sparse viewport keeps memory proportional to measured/visible rows even when the logical model has hundreds of millions of entries. Keyed, variable-height row virtualization (DataTable::set_viewport/DataTable::visible_row_range) windows paint, hit testing, fetching, scrolling, and accessibility to the same visible rows.

Structs§

CellState
What a cell’s row is doing when the cell paints.
ColumnDef
DataTable
DataTableFace
An immediate-mode table for a painted host (a track list): the DataTable’s header, columns, row heights, zebra and lift, painted per frame. paint takes the table’s content rect; the lift and the stripe bleed past it by crate::chrome::row_bleed as the retained table’s do. The host hit-tests with Self::row_at and scrolls by passing the rows it shows.
FaceColumn
One column of a DataTableFace.
TableSort
Which column a table is sorted by and in which direction. Hand the table a crate::LocalState of it (DataTable::with_sort_state) and the order a person chose survives the view being built again.

Enums§

CellAlign
Where a column’s header, text, badges and controls sit across its width. A column follows its TextKind unless it says otherwise: numbers at the trailing edge, everything else at the leading edge.
ColumnWidth
Auto is sized to content at build time (treated as Flex(1.0) until the layout pass can measure it).
TableModelChange
One model notification batch consumed after the backing data has changed. Structural variants preserve mounted controls by stable row key; Self::RowsChanged rebuilds controls only for the named rows.
TableRowState
State of one logical row in a potentially paged or asynchronous table. Loading and error rows keep their geometry and stable key, so completing a fetch does not disturb the scroll anchor or selection.

Traits§

TableModel
Unopinionated backing model for very large or asynchronously populated tables. Implementations need not keep all rows resident: DataTable queries only the visible range plus overscan.

Functions§

text_band
A structural band that follows the type: floor is the widget’s 1× default, which content + padding never undercuts at the default text scale, so 1× layouts are unchanged and only larger type grows the band.
type_line_height
One line of role as the renderer will lay it out: the role’s resolved size times its leading, so a band sized from this at layout time agrees with the line the widget measures and centres at paint time.

Type Aliases§

CellAccessibleValue
CellBadge
A cell’s badge: a short label and the tone it carries (a status, a level). An empty label paints nothing.
CellChecked
Whether a checkbox column’s box is ticked for a row.
CellRender
A cell painter: the cell rect is in the table’s coordinates, and the transform is the one the table paints with (an outer scroll’s offset included).
CellText
A cell’s text, or None for an absent value (a SQL NULL, an unset field), which the table paints dimmed as the column’s absent label.
CellTextRender
Register one per column via ColumnDef::with_text_render; columns without one render nothing (header + chrome still draw). Gets the table’s transform (the cell rect is in the table’s coordinates) and the row’s CellState, so a cell can change with its row: its ink when selected, a glyph that shows under the pointer.
CellWidgetBuilder
Builds a real retained widget for one visible cell. The widget is keyed by the row’s stable identity and the column key, so it survives sorting and scrolling while that cell remains in the mounted window.
ColumnCompare
How two rows order under a column, for the table’s own sorting.
SortCmp