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 re-applies the remembered comparator whenever local rows change,
while DataTable::from_model delegates order and paging to TableModel. Its sparse
viewport keeps memory proportional to what is shown.
Structs§
- Cell
State - What a cell’s row is doing when the cell paints.
- Column
Def - Data
Table - A table of
Rows: theDataTableCorethat does the work (everything a table does, compiled once into the toolkit for rows of any type) and the row type its callers read and write. - Data
Table Core - Data
Table Face - An immediate-mode table for a painted host (a track list): the
DataTable’s header, columns, row heights, zebra and lift, painted per frame.painttakes the table’s content rect; the lift and stripe bleed past it bycrate::chrome::row_bleedas the retained table’s do. The host hit-tests withSelf::row_atand scrolls by passing the rows it shows. - Face
Column - Table
Sort - Which column a table is sorted by and in which direction. Hand the
table a
crate::LocalStateof it (DataTable::with_sort_state) and the order a person chose survives the view being built again.
Enums§
- Cell
Align - Where a column’s header, text, badges and controls sit across its width.
A column follows its
TextKindunless it says otherwise: numbers at the trailing edge, everything else at the leading edge. - Column
Width Autois sized to content at build time (treated asFlex(1.0)until the layout pass can measure it).
Traits§
- Table
Model - Unopinionated backing model for very large or asynchronously populated
tables. Implementations need not keep all rows resident:
DataTablequeries only the visible range plus overscan.
Functions§
- text_
band - A structural band that follows the type:
flooris the widget’s 1× default, whichcontent + paddingnever undercuts at the default text scale, so 1× layouts are unchanged and only larger type grows the band. - type_
line_ height - One line of
roleas 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§
- AnyRow
- A row whose type the table no longer names: what
DataTableCoreholds and its columns read.DataTableconverts at its edges. - Cell
Accessible Value - Cell
Badge - A cell’s badge: a short label and the tone it carries (a status, a level). An empty label paints nothing.
- Cell
Checked - Whether a checkbox column’s box is ticked for a row.
- Cell
Render - 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).
- Cell
Text - A cell’s text, or
Nonefor an absent value (a SQLNULL, an unset field), which the table paints dimmed as the column’s absent label. - Cell
Text Render - 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’sCellState, so a cell can change with its row: its ink when selected, a glyph that shows under the pointer. - Cell
Widget Builder - 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.
- Column
Compare - How two rows order under a column, for the table’s own sorting.
- SortCmp
- Table
Model Change - One model notification batch consumed after the backing data has
changed: a list’s change ([
crate::widget::ListModelChange]) over the table’s row keys. Structural variants preserve mounted controls by stable row key;RowsChangedrebuilds controls only for the named rows.