Skip to main content

DataTableRowModel

Struct DataTableRowModel 

Source
pub struct DataTableRowModel<T> { /* private fields */ }
Expand description

Row model containing processed rows and index mappings.

Manages the complete row processing pipeline from raw data through filtering, sorting, grouping, expansion, and pagination.

Implementations§

Source§

impl<T> DataTableRowModel<T>

Source

pub fn new<F>(data: Vec<T>, id_fn: F) -> DataTableRowModel<T>
where F: Fn(&T, usize) -> DataTableRowId,

Creates a new row model with the given data.

§Parameters
  • data: The raw data rows.
  • id_fn: A function that generates a row ID from row data and index.
§Returns
  • DataTableRowModel<T>: A new row model with all indices initialized.
Source

pub fn from_data(data: Vec<T>) -> DataTableRowModel<T>

Creates a row model using index as ID.

§Parameters
  • data: The raw data rows.
§Returns
  • DataTableRowModel<T>: A new row model with index-based row IDs.
Source

pub fn total_row_count(&self) -> usize

Returns the total number of rows.

§Returns
  • usize: The total row count.
Source

pub fn filtered_row_count(&self) -> usize

Returns the number of filtered rows.

§Returns
  • usize: The filtered row count.
Source

pub fn page_row_count(&self) -> usize

Returns the number of rows in the current page.

§Returns
  • usize: The paginated row count.
Source

pub fn all_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>

Returns all rows.

§Returns
  • impl Iterator<Item = &DataTableRow<T>>: An iterator over all rows.
Source

pub fn filtered_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>

Returns filtered rows.

§Returns
  • impl Iterator<Item = &DataTableRow<T>>: An iterator over filtered rows.
Source

pub fn sorted_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>

Returns sorted rows.

§Returns
  • impl Iterator<Item = &DataTableRow<T>>: An iterator over sorted rows.
Source

pub fn visible_rows(&self) -> impl Iterator<Item = &DataTableRow<T>>

Returns the final visible rows (after all processing).

§Returns
  • impl Iterator<Item = &DataTableRow<T>>: An iterator over visible rows.
Source

pub fn visible_rows_vec(&self) -> Vec<&DataTableRow<T>>

Returns visible rows as a vector.

§Returns
  • Vec<&DataTableRow<T>>: A vector of references to visible rows.
Source

pub fn get_row(&self, id: &DataTableRowId) -> Option<&DataTableRow<T>>

Gets a row by ID.

§Parameters
  • id: The row identifier to look up.
§Returns
  • Option<&DataTableRow<T>>: The row if found.
Source

pub fn get_row_by_index(&self, index: usize) -> Option<&DataTableRow<T>>

Gets a row by index.

§Parameters
  • index: The row index to look up.
§Returns
  • Option<&DataTableRow<T>>: The row if the index is valid.
Source

pub fn all_row_ids(&self) -> Vec<DataTableRowId>

Returns all row IDs.

§Returns
  • Vec<DataTableRowId>: A vector of all row IDs.
Source

pub fn filtered_row_ids(&self) -> Vec<DataTableRowId>

Returns filtered row IDs.

§Returns
  • Vec<DataTableRowId>: A vector of filtered row IDs.
Source

pub fn visible_row_ids(&self) -> Vec<DataTableRowId>

Returns visible row IDs.

§Returns
  • Vec<DataTableRowId>: A vector of visible row IDs.
Source

pub fn invalidate(&mut self)

Marks the model as needing recomputation.

Source

pub fn is_dirty(&self) -> bool

Checks if the model needs recomputation.

§Returns
  • bool: Whether the model needs reprocessing.
Source§

impl<T> DataTableRowModel<T>
where T: Clone,

Source

pub fn set_data<F>(&mut self, data: Vec<T>, id_fn: F)
where F: Fn(&T, usize) -> DataTableRowId,

Updates the data and rebuilds the model.

§Parameters
  • data: The new raw data rows.
  • id_fn: A function that generates a row ID from row data and index.
Source

pub fn process( &mut self, columns: &[ColumnDef<T>], filter_state: &FilterState, sorting_state: &SortingState, expanding_state: &ExpandingState, grouping_state: &GroupingState, pagination_state: &PaginationState, _selection_state: &RowSelectionState, )

Applies the complete row model pipeline.

§Parameters
  • columns: The column definitions.
  • filter_state: The filtering state.
  • sorting_state: The sorting state.
  • expanding_state: The expanding state.
  • grouping_state: The grouping state.
  • pagination_state: The pagination state.
  • _selection_state: The row selection state (reserved for future use).

Trait Implementations§

Source§

impl<T> Default for DataTableRowModel<T>

Provides a default empty row model with no data loaded.

Source§

fn default() -> DataTableRowModel<T>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for DataTableRowModel<T>

§

impl<T> RefUnwindSafe for DataTableRowModel<T>
where T: RefUnwindSafe,

§

impl<T> Send for DataTableRowModel<T>
where T: Send,

§

impl<T> Sync for DataTableRowModel<T>
where T: Sync,

§

impl<T> Unpin for DataTableRowModel<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for DataTableRowModel<T>

§

impl<T> UnwindSafe for DataTableRowModel<T>
where T: UnwindSafe,

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> 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> IntoPropValue<Option<T>> for T

Source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Source§

impl<T> IntoPropValue<T> for T

Source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
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<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Source§

impl<T> HasAllProps<(), T> for T