DataTableView

Struct DataTableView 

Source
pub struct DataTableView {
    pub visible_rows: Vec<usize>,
    pub column_widths: Vec<u16>,
    pub selected_row: usize,
    pub selected_col: usize,
    pub scroll_offset: usize,
    pub horizontal_scroll: usize,
    pub page_size: usize,
    pub visible_col_start: usize,
    pub visible_col_end: usize,
    /* private fields */
}
Expand description

A view of a DataTable with presentation logic

Fields§

§visible_rows: Vec<usize>

Derived/cached view data

§column_widths: Vec<u16>§selected_row: usize

Navigation state

§selected_col: usize§scroll_offset: usize§horizontal_scroll: usize§page_size: usize§visible_col_start: usize§visible_col_end: usize

Implementations§

Source§

impl DataTableView

Source

pub fn new(table: DataTable) -> Self

Create a new view from a DataTable

Source

pub fn table(&self) -> &DataTable

Get the underlying table

Source

pub fn table_mut(&mut self) -> &mut DataTable

Get the underlying table (mutable)

Source

pub fn get_datatable(&self) -> &DataTable

V47: Get reference to DataTable (for BufferAPI compatibility)

Source

pub fn get_datatable_mut(&mut self) -> &mut DataTable

V47: Get mutable reference to DataTable (for BufferAPI compatibility)

Source

pub fn update_viewport(&mut self, terminal_width: u16, terminal_height: u16)

Update visible columns based on terminal width and height

Source

pub fn mode(&self) -> ViewMode

Get current view mode

Source

pub fn visible_row_count(&self) -> usize

Get visible row count after filtering

Source

pub fn apply_filter( &mut self, pattern: String, column_index: Option<usize>, case_sensitive: bool, )

Apply a filter to the view

Source

pub fn clear_filter(&mut self)

Clear the current filter

Source

pub fn apply_sort(&mut self, column_index: usize, order: SortOrder)

Apply sorting to the view

Source

pub fn clear_sort(&mut self)

Clear sorting

Start a search within the view

Source

pub fn next_search_match(&mut self)

Navigate to next search match

Source

pub fn prev_search_match(&mut self)

Navigate to previous search match

Clear search

Source

pub fn enter_filter_mode(&mut self)

Enter filter mode

Source

pub fn enter_search_mode(&mut self)

Enter search mode

Source

pub fn exit_special_mode(&mut self)

Exit special modes back to normal

Source

pub fn handle_navigation(&mut self, key: KeyEvent) -> bool

Handle navigation keys in normal mode

Source

pub fn handle_filter_input(&mut self, key: KeyEvent) -> bool

Handle filter input

Source

pub fn handle_search_input(&mut self, key: KeyEvent) -> bool

Handle search input

Source

pub fn get_selected_value(&self) -> Option<&DataValue>

Get the currently selected cell value

Source

pub fn get_selected_column(&self) -> usize

Get the currently selected column index

Source

pub fn get_status_info(&self) -> String

Get status information for display

Source

pub fn create_table_widget(&self) -> Table<'_>

Create a ratatui Table widget for rendering

Source

pub fn create_input_widget(&self) -> Option<Paragraph<'_>>

Create input widget for filter/search modes

Trait Implementations§

Source§

impl Clone for DataTableView

Source§

fn clone(&self) -> DataTableView

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,