pub struct DataTable { /* private fields */ }Expand description
A scrollable data table widget with columns and rows.
Supports keyboard navigation, row selection, and both vertical and horizontal scrolling.
Implementations§
Source§impl DataTable
impl DataTable
Sourcepub fn with_header_style(self, style: Style) -> Self
pub fn with_header_style(self, style: Style) -> Self
Set the header style.
Sourcepub fn with_row_style(self, style: Style) -> Self
pub fn with_row_style(self, style: Style) -> Self
Set the row style.
Sourcepub fn with_selected_style(self, style: Style) -> Self
pub fn with_selected_style(self, style: Style) -> Self
Set the selected row style.
Sourcepub fn with_border(self, border: BorderStyle) -> Self
pub fn with_border(self, border: BorderStyle) -> Self
Set the border style.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get the number of columns.
Sourcepub fn selected_row(&self) -> usize
pub fn selected_row(&self) -> usize
Get the selected row index.
Sourcepub fn set_selected_row(&mut self, idx: usize)
pub fn set_selected_row(&mut self, idx: usize)
Set the selected row (clamped to valid range).
Sourcepub fn selected_row_data(&self) -> Option<&[String]>
pub fn selected_row_data(&self) -> Option<&[String]>
Get the data for the selected row.
Sourcepub fn col_offset(&self) -> u16
pub fn col_offset(&self) -> u16
Get the horizontal scroll offset.
Sourcepub fn with_resizable_columns(self, enabled: bool) -> Self
pub fn with_resizable_columns(self, enabled: bool) -> Self
Enable column resizing.
Sourcepub fn sort_by_column(&mut self, col_idx: usize)
pub fn sort_by_column(&mut self, col_idx: usize)
Sort by the given column index (toggle ascending/descending).
First call sorts ascending; repeated calls on the same column toggle direction.
Sourcepub fn clear_sort(&mut self)
pub fn clear_sort(&mut self)
Clear the sort and restore original order.
Sourcepub fn sort_state(&self) -> Option<(usize, bool)>
pub fn sort_state(&self) -> Option<(usize, bool)>
Get the current sort state: (column_index, ascending).
Sourcepub fn set_column_width(&mut self, col_idx: usize, width: u16)
pub fn set_column_width(&mut self, col_idx: usize, width: u16)
Set the width of a column by index.
Sourcepub fn column_width(&self, col_idx: usize) -> Option<u16>
pub fn column_width(&self, col_idx: usize) -> Option<u16>
Get the width of a column by index.
Trait Implementations§
Source§impl InteractiveWidget for DataTable
impl InteractiveWidget for DataTable
Source§fn handle_event(&mut self, event: &Event) -> EventResult
fn handle_event(&mut self, event: &Event) -> EventResult
Handle an input event. Returns whether the event was consumed.
Auto Trait Implementations§
impl Freeze for DataTable
impl RefUnwindSafe for DataTable
impl Send for DataTable
impl Sync for DataTable
impl Unpin for DataTable
impl UnwindSafe for DataTable
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