Skip to main content

DataTableRow

Struct DataTableRow 

Source
pub struct DataTableRow<T> {
    pub id: DataTableRowId,
    pub original: T,
    pub original_index: usize,
    pub view_index: usize,
    pub depth: usize,
    pub parent_id: Option<DataTableRowId>,
    pub sub_row_ids: Vec<DataTableRowId>,
    pub is_group_row: bool,
    pub group_value: Option<String>,
    pub can_expand: bool,
    pub can_select: bool,
}
Expand description

A row in the table with associated metadata.

Wraps the original data and adds metadata for table operations like selection, expansion, grouping, and nested row support.

Fields§

§id: DataTableRowId

Unique identifier for the row.

§original: T

The original row data.

§original_index: usize

Index in the original data array.

§view_index: usize

Index in the current view (after filtering/sorting).

§depth: usize

Depth level for nested/grouped rows.

§parent_id: Option<DataTableRowId>

Parent row ID for nested rows.

§sub_row_ids: Vec<DataTableRowId>

Child row IDs for expandable rows.

§is_group_row: bool

Whether this is a group row (aggregated).

§group_value: Option<String>

Group value for grouped rows.

§can_expand: bool

Whether this row can be expanded.

§can_select: bool

Whether this row can be selected.

Implementations§

Source§

impl<T> DataTableRow<T>

Source

pub fn new( id: impl Into<DataTableRowId>, original: T, original_index: usize, ) -> DataTableRow<T>

Creates a new row with the given ID and data.

§Parameters
  • id: The unique row identifier.
  • original: The original row data.
  • original_index: The index in the original data array.
§Returns
  • DataTableRow<T>: A new row with default metadata.
Source

pub fn from_index(original: T, index: usize) -> DataTableRow<T>

Creates a row from index (using index as ID).

§Parameters
  • original: The original row data.
  • index: The row index used as both ID and original index.
§Returns
  • DataTableRow<T>: A new row with index-based ID.
Source

pub fn with_view_index(self, index: usize) -> DataTableRow<T>

Sets the view index.

§Parameters
  • index: The new view index.
§Returns
  • Self: The modified row.
Source

pub fn with_depth(self, depth: usize) -> DataTableRow<T>

Sets the depth level.

§Parameters
  • depth: The nesting depth level.
§Returns
  • Self: The modified row.
Source

pub fn with_parent(self, parent_id: DataTableRowId) -> DataTableRow<T>

Sets the parent row ID.

§Parameters
  • parent_id: The parent row identifier.
§Returns
  • Self: The modified row.
Source

pub fn with_sub_rows(self, sub_row_ids: Vec<DataTableRowId>) -> DataTableRow<T>

Sets the sub-row IDs.

§Parameters
  • sub_row_ids: The child row identifiers.
§Returns
  • Self: The modified row.
Source

pub fn as_group_row(self, group_value: String) -> DataTableRow<T>

Marks this as a group row.

§Parameters
  • group_value: The group value label.
§Returns
  • Self: The modified row.
Source

pub fn with_can_select(self, can_select: bool) -> DataTableRow<T>

Sets whether this row can be selected.

§Parameters
  • can_select: Whether the row is selectable.
§Returns
  • Self: The modified row.
Source

pub fn data(&self) -> &T

Returns a reference to the original data.

§Returns
  • &T: A reference to the original row data.
Source

pub fn data_mut(&mut self) -> &mut T

Returns a mutable reference to the original data.

§Returns
  • &mut T: A mutable reference to the original row data.
Source

pub fn has_sub_rows(&self) -> bool

Returns whether this row has sub-rows.

§Returns
  • bool: Whether the row has child rows.
Source

pub fn is_leaf(&self) -> bool

Returns whether this row is a leaf (no sub-rows).

§Returns
  • bool: Whether the row is a leaf node.
Source

pub fn is_root(&self) -> bool

Returns whether this row is a root row (no parent).

§Returns
  • bool: Whether the row has no parent.
Source

pub fn map<U, F>(self, f: F) -> DataTableRow<U>
where F: FnOnce(T) -> U,

Maps the row data to a new type.

§Parameters
  • f: A function to transform the row data.
§Returns
  • DataTableRow<U>: A new row with the transformed data.
Source§

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

Source

pub fn clone_with_view_index(&self, view_index: usize) -> DataTableRow<T>

Clones the row with a new view index.

§Parameters
  • view_index: The new view index.
§Returns
  • Self: A cloned row with the updated view index.

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> DataTableRow<T>

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

impl<T> Debug for DataTableRow<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for DataTableRow<T>
where T: Freeze,

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for DataTableRow<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for DataTableRow<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> 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> 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> 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<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