pub struct TableState {
pub selected: usize,
pub offset: usize,
pub visible_height: usize,
pub total_rows: usize,
pub sort_column: usize,
pub sort_ascending: bool,
}Expand description
Table state that tracks selection, scroll position, and sort column.
Fields§
§selected: usizeCurrently selected row index.
offset: usizeScroll offset (first visible row).
visible_height: usizeVisible height (set on each render).
total_rows: usizeTotal number of rows.
sort_column: usizeCurrent sort column index.
sort_ascending: boolSort ascending.
Implementations§
Source§impl TableState
impl TableState
pub fn new() -> Self
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll down by one row.
Sourcepub fn scroll_top(&mut self)
pub fn scroll_top(&mut self)
Jump to first row.
Sourcepub fn scroll_bottom(&mut self)
pub fn scroll_bottom(&mut self)
Jump to last row.
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> bool
pub fn handle_key(&mut self, key: KeyEvent) -> bool
Handle common navigation keys. Returns true if consumed.
Sourcepub fn visible_range(&self) -> Range<usize>
pub fn visible_range(&self) -> Range<usize>
Visible row range for slicing data.
Sourcepub fn to_ratatui_state(&self) -> TableState
pub fn to_ratatui_state(&self) -> TableState
Convert ratatui table state from our state.
Trait Implementations§
Source§impl Debug for TableState
impl Debug for TableState
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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