pub struct TableState {
pub selected: Option<usize>,
pub hovered: Option<usize>,
pub offset: usize,
/* private fields */
}Expand description
Mutable state for a Table widget.
Fields§
§selected: Option<usize>Index of the currently selected row, if any.
hovered: Option<usize>Index of the currently hovered row, if any.
offset: usizeScroll offset (first visible row index).
Implementations§
Source§impl TableState
impl TableState
Sourcepub fn select(&mut self, index: Option<usize>)
pub fn select(&mut self, index: Option<usize>)
Set the selected row index, resetting offset on deselect.
Sourcepub fn with_persistence_id(self, id: impl Into<String>) -> Self
pub fn with_persistence_id(self, id: impl Into<String>) -> Self
Create a new TableState with a persistence ID for state saving.
Sourcepub fn persistence_id(&self) -> Option<&str>
pub fn persistence_id(&self) -> Option<&str>
Get the persistence ID, if set.
Source§impl TableState
impl TableState
Sourcepub fn undo_id(&self) -> UndoWidgetId
pub fn undo_id(&self) -> UndoWidgetId
Get the undo widget ID.
This can be used to associate undo commands with this state instance.
Sourcepub fn sort_column(&self) -> Option<usize>
pub fn sort_column(&self) -> Option<usize>
Get the current sort column.
Sourcepub fn sort_ascending(&self) -> bool
pub fn sort_ascending(&self) -> bool
Get whether the sort is ascending.
Sourcepub fn set_filter(&mut self, filter: impl Into<String>)
pub fn set_filter(&mut self, filter: impl Into<String>)
Set the filter text.
Trait Implementations§
Source§impl Clone for TableState
impl Clone for TableState
Source§fn clone(&self) -> TableState
fn clone(&self) -> TableState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableState
impl Debug for TableState
Source§impl Default for TableState
impl Default for TableState
Source§fn default() -> TableState
fn default() -> TableState
Returns the “default value” for a type. Read more
Source§impl Stateful for TableState
impl Stateful for TableState
Source§type State = TablePersistState
type State = TablePersistState
The state type that gets persisted. Read more
Source§fn save_state(&self) -> TablePersistState
fn save_state(&self) -> TablePersistState
Extract current state for persistence. Read more
Source§fn restore_state(&mut self, state: TablePersistState)
fn restore_state(&mut self, state: TablePersistState)
Restore state from persistence. Read more
Source§fn state_version() -> u32
fn state_version() -> u32
State schema version for forward-compatible migrations. Read more
Source§impl TableUndoExt for TableState
impl TableUndoExt for TableState
Source§fn filter_text(&self) -> &str
fn filter_text(&self) -> &str
Get the current filter.
Source§fn set_filter_text(&mut self, filter: &str)
fn set_filter_text(&mut self, filter: &str)
Set the filter.
Source§impl UndoSupport for TableState
impl UndoSupport for TableState
Source§fn undo_widget_id(&self) -> UndoWidgetId
fn undo_widget_id(&self) -> UndoWidgetId
Get the widget’s unique ID for undo tracking.
Auto Trait Implementations§
impl Freeze for TableState
impl RefUnwindSafe for TableState
impl Send for TableState
impl Sync for TableState
impl Unpin for TableState
impl UnwindSafe for TableState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more