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§
- Cell
State - What a cell’s row is doing when the cell paints.
- Column
Def - Data
Table - 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 the 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 - One column of a
DataTableFace. - 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).- Table
Model Change - One model notification batch consumed after the backing data has changed.
Structural variants preserve mounted controls by stable row key;
Self::RowsChangedrebuilds controls only for the named rows. - Table
RowState - 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§
- 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§
- 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