Available on crate feature
data-table only.Expand description
Records in rows and columns, with sorting, filtering, selection and pages.
State owns the rows, the Columns that read them, and everything
the reader changes: the sort, the search and column filters, the page,
the selection and which columns are hidden. Its
update is pure, so it is tested without a renderer.
The view only builds the rows of the current page that are in view, and
the header stays put while they scroll.
Narrower than its breakpoint, the table turns into a stack of cards, one per row, with each column as a labelled line, so it never overflows a phone screen.
The table resolves its keys through a Keymap of Actions while it
has focus, which it takes when pressed; see default_keymap.
Structs§
- Column
- One column: its header, how it reads a row, and how it is shown.
- Data
Table - A data table builder. Convert it into an
Elementto render. - RowStyle
- The colours of a row.
- State
- The rows, the columns and how the reader is looking at them.
- Status
- How a row is shown.
Enums§
- Action
- What a data table keyboard shortcut does.
- Align
- How a column’s header and cells line up.
- Direction
- Which way a column is sorted.
- Event
- Everything that changes a table.
- Output
- What the app may need to act on after an
Event. - Value
- A cell’s value, which sorting, searching and filtering read.
Constants§
- BREAKPOINT
- Below this width, in logical pixels, rows become cards.
- CARD_
LINE - Height of one labelled line in a card.
- HEADER_
HEIGHT - Height of the header row.
- PAGE_
SIZES - The page sizes offered unless the state sets its own.
- ROW_
HEIGHT - Height of every body row.
- SKELETON_
ROWS - Placeholder rows shown while loading.
Functions§
- column
- A sortable, searchable and hideable column that fills an equal share
of the width.
valuereads the cell from a row. - compare
- Orders two values: numbers by size, text alphabetically ignoring case, and numbers before text.
- data_
table - Renders
state. Withouton_eventevery control renders disabled. - default_
keymap - The default data table shortcuts:
- frame_
style - The frame around the table: a subtle border with rounded corners.
- row_
style - Resolves a row’s colours: muted when selected, a lighter tint under the pointer.
- skeleton_
style - A placeholder bar in a loading row.
- sort_
glyph - The sort indicator for a column: arrows up and down while unsorted, or the direction.
Type Aliases§
- Column
Id - Names a column. Sorting, filters and hiding refer to columns by it.