GridCommand API

Definition

#[non_exhaustive]
pub enum GridCommand { /* 30 variants */ }

All mutations to GridState go through state.apply(GridCommand).

All variants

Selection

SelectCell(CellCoord)
ExtendSelection(CellCoord)
ClearSelection
MoveSelection { delta_row: i64, delta_col: i64, extend: bool }
SelectRow(u64)
ExtendRowSelection(u64)
SelectCol(usize)
ExtendColSelection(usize)

Scrolling & Viewport

ScrollTo { x: f64, y: f64 }
ScrollBy { dx: f64, dy: f64 }
Resize { width: f64, height: f64 }

Columns

ResizeColumn { col_idx: usize, new_width: f64 }
AutoFitColumn { col_idx: usize, char_width: f64, header_char_width: f64, cell_padding: f64 }
MoveColumn { from_idx: usize, to_idx: usize }
SetPinnedColumnCount { count: usize }

Sorting & Filtering

ToggleSort { col_key: String }
SetColumnFilter { col_key: String, text: String }
ClearAllFilters

Editing

StartEdit { row: u64, col_key: String }
CommitEdit { row: u64, col_key: String, value: String }
CancelEdit

Clipboard

CopySelection
CutSelection
PasteAt { text: String }
Search { query: String }
SearchNext
SearchPrev
ClearSearch

Undo / Redo

Undo
Redo

Data & Display

SetHoveredRow(Option<u64>)
NotifyPageLoaded
SetTotalRowCount(u64)

Behaviour toggles

SetEditable(bool)          // global inline-edit on/off
SetSelectable(bool)        // global selection on/off (clears selection when false)
SetColumnReorderable(bool) // header drag-to-reorder on/off (MoveColumn unaffected)

CommandOutput

#[non_exhaustive]
pub enum CommandOutput {
    None,
    CopyText(String),
    CopyError(CopyError),
}

#[non_exhaustive]
pub enum CopyError {
    NoSelection,
    TooManyRows,
}
CommandOutput
CopySelectionCopyText(tsv) or CopyError
CutSelectionCopyText(tsv) or CopyError
All othersNone