pub struct DataTable<T: Clone> { /* private fields */ }Expand description
Main table instance that coordinates all table functionality.
Manages columns, data, and state, providing methods for sorting, filtering, pagination, selection, and all other table operations.
Implementations§
Source§impl<T: Clone> DataTable<T>
impl<T: Clone> DataTable<T>
Sourcepub fn new(options: DataTableOptions) -> Self
pub fn new(options: DataTableOptions) -> Self
Sourcepub fn builder() -> DataTableOptionsBuilder
pub fn builder() -> DataTableOptionsBuilder
Sourcepub fn set_columns(&mut self, columns: Vec<ColumnDef<T>>)
pub fn set_columns(&mut self, columns: Vec<ColumnDef<T>>)
Sourcepub fn set_data<F>(&mut self, data: Vec<T>, id_fn: F)
pub fn set_data<F>(&mut self, data: Vec<T>, id_fn: F)
Sets the table data.
§Parameters
data: The new raw data rows.id_fn: A function that generates a row ID from row data and index.
Sourcepub fn set_data_indexed(&mut self, data: Vec<T>)
pub fn set_data_indexed(&mut self, data: Vec<T>)
Sourcepub fn state_mut(&mut self) -> &mut DataTableState
pub fn state_mut(&mut self) -> &mut DataTableState
Returns a mutable reference to the state.
§Returns
&mut DataTableState: A mutable reference to the table state.
Sourcepub fn state(&self) -> &DataTableState
pub fn state(&self) -> &DataTableState
Sourcepub fn options(&self) -> &DataTableOptions
pub fn options(&self) -> &DataTableOptions
Sourcepub fn row_model(&self) -> &DataTableRowModel<T>
pub fn row_model(&self) -> &DataTableRowModel<T>
Sourcepub fn visible_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>
pub fn visible_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>
Returns visible rows after processing.
§Returns
impl Iterator<Item = &DataTableRow<T>>: An iterator over visible rows.
Sourcepub fn total_row_count(&self) -> usize
pub fn total_row_count(&self) -> usize
Sourcepub fn filtered_row_count(&self) -> usize
pub fn filtered_row_count(&self) -> usize
Sourcepub fn page_row_count(&self) -> usize
pub fn page_row_count(&self) -> usize
Sourcepub fn get_row(&self, id: &DataTableRowId) -> Option<&DataTableRow<T>>
pub fn get_row(&self, id: &DataTableRowId) -> Option<&DataTableRow<T>>
Sourcepub fn visible_column_ids(&self) -> Vec<ColumnId>
pub fn visible_column_ids(&self) -> Vec<ColumnId>
Returns visible column IDs in order.
§Returns
Vec<ColumnId>: The ordered list of visible column IDs.
Sourcepub fn visible_columns(&self) -> Vec<&ColumnDef<T>>
pub fn visible_columns(&self) -> Vec<&ColumnDef<T>>
Returns visible columns in order.
§Returns
Vec<&ColumnDef<T>>: References to visible column definitions.
Sourcepub fn get_column(&self, id: &ColumnId) -> Option<&ColumnDef<T>>
pub fn get_column(&self, id: &ColumnId) -> Option<&ColumnDef<T>>
Sourcepub fn toggle_sort(&mut self, column_id: impl Into<ColumnId>, multi: bool)
pub fn toggle_sort(&mut self, column_id: impl Into<ColumnId>, multi: bool)
Toggles sorting for a column.
§Parameters
column_id: The column identifier to toggle sorting for.multi: Whether to add to multi-sort list.
Sourcepub fn set_column_filter(
&mut self,
column_id: impl Into<ColumnId>,
value: impl Into<String>,
)
pub fn set_column_filter( &mut self, column_id: impl Into<ColumnId>, value: impl Into<String>, )
Sourcepub fn set_global_filter(&mut self, value: impl Into<String>)
pub fn set_global_filter(&mut self, value: impl Into<String>)
Sourcepub fn toggle_row_selection(&mut self, row_id: DataTableRowId)
pub fn toggle_row_selection(&mut self, row_id: DataTableRowId)
Sourcepub fn select_all_rows(&mut self)
pub fn select_all_rows(&mut self)
Selects all filtered rows.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clears row selection.
Sourcepub fn toggle_row_expansion(&mut self, row_id: DataTableRowId)
pub fn toggle_row_expansion(&mut self, row_id: DataTableRowId)
Sourcepub fn toggle_column_visibility(&mut self, column_id: ColumnId)
pub fn toggle_column_visibility(&mut self, column_id: ColumnId)
Sourcepub fn go_to_page(&mut self, page: usize)
pub fn go_to_page(&mut self, page: usize)
Sourcepub fn previous_page(&mut self)
pub fn previous_page(&mut self)
Goes to the previous page.
Sourcepub fn set_page_size(&mut self, size: usize)
pub fn set_page_size(&mut self, size: usize)
Auto Trait Implementations§
impl<T> Freeze for DataTable<T>
impl<T> !RefUnwindSafe for DataTable<T>
impl<T> Send for DataTable<T>where
T: Send,
impl<T> Sync for DataTable<T>where
T: Sync,
impl<T> Unpin for DataTable<T>where
T: Unpin,
impl<T> UnsafeUnpin for DataTable<T>
impl<T> !UnwindSafe for DataTable<T>
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