pub struct TableState {
pub id: CompactString,
pub columns: Vec<ColumnState>,
pub highlights: Highlights,
pub highlights_changed: bool,
pub active_rows: Vec<usize>,
pub selected_rows: RoaringBitmap,
pub expanded_rows: RoaringBitmap,
pub last_clicked_visible_index: Option<usize>,
pub filter_matches: RoaringBitmap,
pub filter_cache_dirty: bool,
pub sorted_children_cache: HashMap<usize, Arc<Vec<usize>>, RandomState>,
}Expand description
Holds interactive visual properties for columns and selection structures.
Fields§
§id: CompactString§columns: Vec<ColumnState>§highlights: Highlights§highlights_changed: bool§active_rows: Vec<usize>§selected_rows: RoaringBitmap§expanded_rows: RoaringBitmap§last_clicked_visible_index: Option<usize>§filter_matches: RoaringBitmap§filter_cache_dirty: bool§sorted_children_cache: HashMap<usize, Arc<Vec<usize>>, RandomState>Implementations§
Source§impl TableState
impl TableState
Sourcepub fn new(id: impl Into<CompactString>, row_count: usize) -> Self
pub fn new(id: impl Into<CompactString>, row_count: usize) -> Self
Constructs and initializes view settings.
Sourcepub fn get_filter_state(&self) -> Vec<(usize, Filter)>
pub fn get_filter_state(&self) -> Vec<(usize, Filter)>
Accesses the active filter options defined for each column.
Sourcepub fn get_sort_state(&self) -> Option<(usize, bool)>
pub fn get_sort_state(&self) -> Option<(usize, bool)>
Accesses active sorting criteria (column offset and sorting order).
Sourcepub fn counts_header(&self, row_len: usize) -> String
pub fn counts_header(&self, row_len: usize) -> String
Renders dynamic status headers detailing matching selection counts.
Sourcepub fn process_responses(
&mut self,
provider: &dyn TableProvider,
responses: Vec<ColResponse>,
) -> Result<(), TableError>
pub fn process_responses( &mut self, provider: &dyn TableProvider, responses: Vec<ColResponse>, ) -> Result<(), TableError>
Applies header actions (sorting updates and filtering changes) to the active indices.
Sourcepub fn apply_new_sort(
&mut self,
provider: &dyn TableProvider,
sort_col: usize,
) -> Result<(), TableError>
pub fn apply_new_sort( &mut self, provider: &dyn TableProvider, sort_col: usize, ) -> Result<(), TableError>
Sets up a new sorting column constraint and sorts active elements.
Sourcepub fn apply_all_filters(
&mut self,
provider: &dyn TableProvider,
filters: &[(usize, Filter)],
) -> Result<(), TableError>
pub fn apply_all_filters( &mut self, provider: &dyn TableProvider, filters: &[(usize, Filter)], ) -> Result<(), TableError>
Evaluates filtering constraints, resetting the active index map.
Sourcepub fn refresh_view(
&mut self,
provider: &dyn TableProvider,
) -> Result<bool, TableError>
pub fn refresh_view( &mut self, provider: &dyn TableProvider, ) -> Result<bool, TableError>
Brings the active row set up to date only when the view is dirty, returning
true if it was recomputed this call. This is the intended per-frame entry
point: it is a cheap no-op when nothing has changed, avoiding a full O(N)
filter pass and sort every frame.
For tree providers this delegates to Self::flatten_tree; for flat tables
it reapplies the active filters and (if any) the current sort.
Sourcepub fn apply_incremental_filter(
&mut self,
provider: &dyn TableProvider,
filter_col: usize,
filter: &Filter,
) -> Result<(), TableError>
pub fn apply_incremental_filter( &mut self, provider: &dyn TableProvider, filter_col: usize, filter: &Filter, ) -> Result<(), TableError>
Runs filter constraints incrementally across the already-filtered row set.
Sourcepub fn show_tree_cell(
&mut self,
ui: &mut Ui,
row_index: usize,
hierarchy: RowHierarchy,
) -> bool
pub fn show_tree_cell( &mut self, ui: &mut Ui, row_index: usize, hierarchy: RowHierarchy, ) -> bool
Renders the tree indentation guidelines and expand/collapse arrow inside a tree cell.
Returns true if the expansion state changed (allowing immediate-mode viewport updates).
Sourcepub fn handle_row_selection(&mut self, modifiers: Modifiers, row_index: usize)
pub fn handle_row_selection(&mut self, modifiers: Modifiers, row_index: usize)
Evaluates clicks and modifier keys to update row selections.
Sourcepub fn rebuild_tree_filter_cache(&mut self, provider: &dyn TableProvider)
pub fn rebuild_tree_filter_cache(&mut self, provider: &dyn TableProvider)
Rebuilds the O(N) reverse-propagation subtree filter cache from scratch if dirty.
Sourcepub fn flatten_tree(&mut self, provider: &dyn TableProvider)
pub fn flatten_tree(&mut self, provider: &dyn TableProvider)
Recursively flattens the visible tree nodes matching the active filters into active_rows.
Trait Implementations§
Source§impl Debug for TableState
impl Debug for TableState
Source§impl Default for TableState
impl Default for TableState
Source§fn default() -> TableState
fn default() -> TableState
Source§impl TableStateExt for TableState
impl TableStateExt for TableState
fn collect_responses(&mut self, responses: Vec<ColResponse>) -> TableChanges
Auto Trait Implementations§
impl Freeze for TableState
impl RefUnwindSafe for TableState
impl Send for TableState
impl Sync for TableState
impl Unpin for TableState
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more