Skip to content

Table

A virtualized tabular collection with header, row, and cell parts.

Loading interactive demo…

#Import

Import Table from quickgui.

use quickgui::*;

#Usage

TableState::new(rows, columns)
    .element("issues")

#Anatomy

  • Table::root
  • Table::header
  • Table::row
  • Table::cell_part

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

TableState

View source
pub fn new(row_count: usize) -> Self
with_selection_modepub fn with_selection_mode(mut self, mode: TableSelectionMode) -> Self—

Allow Shift ranges, platform-modified toggles, and Select All.

pub fn with_selection_mode(mut self, mode: TableSelectionMode) -> Self
View source
with_layoutpub fn with_layout(mut self, layout: TableLayout) -> Self—

Configures with layout for this part.

pub fn with_layout(mut self, layout: TableLayout) -> Self
View source
layoutpub const fn layout(&self) -> TableLayout—

Configures layout for this part.

pub const fn layout(&self) -> TableLayout
View source
set_layoutpub fn set_layout(&mut self, layout: TableLayout) -> bool—

Configures set layout for this part.

pub fn set_layout(&mut self, layout: TableLayout) -> bool
View source
row_countpub const fn row_count(&self) -> usize—

Configures row count for this part.

pub const fn row_count(&self) -> usize
View source
set_row_countpub fn set_row_count(&mut self, row_count: usize) -> bool—

Configures set row count for this part.

pub fn set_row_count(&mut self, row_count: usize) -> bool
View source
selection_modepub const fn selection_mode(&self) -> TableSelectionMode—

Configures selection mode for this part.

pub const fn selection_mode(&self) -> TableSelectionMode
View source
set_selection_modepub fn set_selection_mode(&mut self, mode: TableSelectionMode) -> bool—

Configures set selection mode for this part.

pub fn set_selection_mode(&mut self, mode: TableSelectionMode) -> bool
View source
selectionpub const fn selection(&self) -> &TableSelection—

The retained row selection.

pub const fn selection(&self) -> &TableSelection
View source
selection_versionpub const fn selection_version(&self) -> u64—

A counter bumped once every time the retained selection actually changes. Comparing this across a frame is cheaper than cloning the selection, and it is what the table itself uses to decide whether to dispatch [`TableSelectionChanged`].

pub const fn selection_version(&self) -> u64
View source
set_selectionpub fn set_selection(&mut self, selection: TableSelection) -> bool—

Replace the retained row selection, dropping rows past the current row count.

pub fn set_selection(&mut self, selection: TableSelection) -> bool
View source
selection_anchorpub const fn selection_anchor(&self) -> Option<usize>—

The row a Shift range extends from.

pub const fn selection_anchor(&self) -> Option<usize>
View source
is_row_selectedpub fn is_row_selected(&self, row: usize) -> bool—

Configures is row selected for this part.

pub fn is_row_selected(&self, row: usize) -> bool
View source
select_rowpub fn select_row(&mut self, row: usize) -> bool—

Select exactly one row and anchor future Shift ranges there.

pub fn select_row(&mut self, row: usize) -> bool
View source
toggle_row_selectionpub fn toggle_row_selection(&mut self, row: usize) -> bool—

Add or remove one row from a multiple selection. A single-selection table selects the row instead of toggling it, so the platform-modified click of a single-selection list behaves like an ordinary click.

pub fn toggle_row_selection(&mut self, row: usize) -> bool
View source
select_row_rangepub fn select_row_range(&mut self, row: usize) -> bool—

Replace the selection with the range between the anchor and `row`.

pub fn select_row_range(&mut self, row: usize) -> bool
View source
select_all_rowspub fn select_all_rows(&mut self) -> bool—

Select every row. A single-selection table refuses.

pub fn select_all_rows(&mut self) -> bool
View source
clear_row_selectionpub fn clear_row_selection(&mut self) -> bool—

Configures clear row selection for this part.

pub fn clear_row_selection(&mut self) -> bool
View source
editing_cellpub const fn editing_cell(&self) -> Option<TableCellPosition>—

The open inline editor, if any.

pub const fn editing_cell(&self) -> Option<TableCellPosition>
View source
begin_editpub fn begin_edit(&mut self, position: TableCellPosition, column_count: usize) -> bool—

Open an inline editor over one cell and make it the active cell. The application owns the editor element and its draft value; QuickGUI retains only which cell is being edited, gives that cell its own key context, and reports Return and Escape.

pub fn begin_edit(&mut self, position: TableCellPosition, column_count: usize) -> bool
View source
end_editpub fn end_edit(&mut self) -> Option<TableCellPosition>—

Close the open editor. Returns the cell that was being edited.

pub fn end_edit(&mut self) -> Option<TableCellPosition>
View source
column_widthpub fn column_width(&self, column: ElementId) -> Option<f32>—

The retained width of a resizable column.

pub fn column_width(&self, column: ElementId) -> Option<f32>
View source
set_column_widthpub fn set_column_width(&mut self, column: ElementId, width: f32) -> bool—

Replace one resizable column's width, clamped to its declared minimum and the table's maximum. A column that is not resizable is ignored.

pub fn set_column_width(&mut self, column: ElementId, width: f32) -> bool
View source
resize_columnpub fn resize_column(&mut self, column: ElementId, delta: f32) -> bool—

Move one resizable column's trailing edge by a logical-pixel delta.

pub fn resize_column(&mut self, column: ElementId, delta: f32) -> bool
View source
column_orderpub fn column_order(&self) -> &[u16]—

The declared column indices in their current display order.

pub fn column_order(&self) -> &[u16]
View source
move_columnpub fn move_column(&mut self, column_index: usize, delta: isize) -> bool—

Move one declared column to a different position in the display order.

pub fn move_column(&mut self, column_index: usize, delta: isize) -> bool
View source
selected_cellpub const fn selected_cell(&self) -> Option<TableCellPosition>—

Configures selected cell for this part.

pub const fn selected_cell(&self) -> Option<TableCellPosition>
View source
selected_rowpub fn selected_row(&self) -> Option<usize>—

Configures selected row for this part.

pub fn selected_row(&self) -> Option<usize>
View source
sortpub const fn sort(&self) -> Option<TableSort>—

Configures sort for this part.

pub const fn sort(&self) -> Option<TableSort>
View source
set_sortpub fn set_sort(&mut self, sort: Option<TableSort>) -> bool—

Configures set sort for this part.

pub fn set_sort(&mut self, sort: Option<TableSort>) -> bool
View source
clear_selectionpub fn clear_selection(&mut self) -> bool—

Configures clear selection for this part.

pub fn clear_selection(&mut self) -> bool
View source
select_cellpub fn select_cell(&mut self, position: TableCellPosition, column_count: usize) -> bool—

Make one cell active and collapse the row selection onto its row. This is the unmodified click and arrow-key behavior of every desktop list. Use [`Self::set_selection`] or [`Self::toggle_row_selection`] to change selection without moving the active cell.

pub fn select_cell(&mut self, position: TableCellPosition, column_count: usize) -> bool
View source
visible_rowspub fn visible_rows(&self) -> std::ops::Range<usize>—

Configures visible rows for this part.

pub fn visible_rows(&self) -> std::ops::Range<usize>
View source
list_statepub fn list_state(&self) -> &ListState—

Configures list state for this part.

pub fn list_state(&self) -> &ListState
View source
focus_handlepub fn focus_handle(id: impl Into<ElementId>) -> FocusHandle—

Configures focus handle for this part.

pub fn focus_handle(id: impl Into<ElementId>) -> FocusHandle
View source
row_idpub fn row_id(id: impl Into<ElementId>, row: usize) -> ElementId—

Configures row id for this part.

pub fn row_id(id: impl Into<ElementId>, row: usize) -> ElementId
View source
cell_idpub fn cell_id(id: impl Into<ElementId>, position: TableCellPosition) -> ElementId—

Configures cell id for this part.

pub fn cell_id(id: impl Into<ElementId>, position: TableCellPosition) -> ElementId
View source
column_header_idpub fn column_header_id(id: impl Into<ElementId>, column: ElementId) -> ElementId—

Configures column header id for this part.

pub fn column_header_id(id: impl Into<ElementId>, column: ElementId) -> ElementId
View source
resize_handle_idpub fn resize_handle_id(id: impl Into<ElementId>, column: ElementId) -> ElementId—

The stable identity of one column's resize handle.

pub fn resize_handle_id(id: impl Into<ElementId>, column: ElementId) -> ElementId
View source

TableState::element

View source
pub fn element<V, H, E, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access: fn(&mut V) -> &mut TableState, render_header: RenderHeader, render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, H: IntoElement, E: IntoElement, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build a complete unstyled virtualized, sortable, keyboard-navigable table. `render_header` owns every visible header declaration, including label, sort indicator, and the placement of the resize handle QuickGUI hands it. `render_cell` owns every visible cell declaration, including the inline editor it mounts while `editing` is set, and runs only for mounted rows. QuickGUI decorates those elements with fixed grid geometry, identities, pointer/keyboard behavior, and accessibility semantics but adds no paint. `activate` receives the current logical cell when Return is dispatched outside an editor; selection, sort, width, order, and editing state remain directly readable from `access`.

TableState::element_with

View source
pub fn element_with<V, H, E, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access_source: StateAccessor<V, TableState>, render_header: RenderHeader, render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, H: IntoElement, E: IntoElement, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build the table against a per-instance retained-state accessor. A host that renders many declared tables through one view passes an accessor that captures which [`TableState`] each registered listener resolves. Every row is a plain container; [`Self::element_with_rows`] lets the caller paint the rows too.

TableState::element_with_rows

View source
pub fn element_with_rows<V, R, H, E, RenderRow, RenderHeader, RenderCell, Activate>( &mut self, cx: &mut ViewContext<'_, V>, id: impl Into<ElementId>, columns: &[TableColumn], access_source: StateAccessor<V, TableState>, mut render_row: RenderRow, mut render_header: RenderHeader, mut render_cell: RenderCell, activate: Activate, ) -> Element where V: 'static, R: IntoElement, H: IntoElement, E: IntoElement, RenderRow: FnMut(TableRowState) -> R, RenderHeader: FnMut(TableHeaderState<'_>) -> H, RenderCell: FnMut(TableCellState<'_>) -> E, Activate: Fn(&mut V, TableCellPosition, &mut EventContext) + Clone + 'static,

Build the table with a caller-owned container for every mounted row. `render_row` returns the element a row's cells are laid out in. QuickGUI adds the grid tracks, the row height, the row identity, and the collection semantics on top of it, so the caller declares only the row's paint — a background, a divider, a hover state, or a [`selected_style`](Element::selected_style) that paints while the row is selected — never its layout. The renderer runs only for mounted rows.