Skip to main content

DataTableProps

Struct DataTableProps 

Source
pub struct DataTableProps {
    pub columns: LocalBoxSignalVec<'static, TableColumn>,
    pub rows: LocalBoxSignalVec<'static, (String, Vec<Dom>)>,
    pub sorted_by: LocalBoxSignal<'static, Option<(String, SortDirection)>>,
    pub on_sort: Box<dyn Fn(String, SortDirection) + 'static>,
    pub on_row_click: Box<dyn Fn(String) + 'static>,
    pub rows_clickable: bool,
    pub apply: Option<Box<dyn FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement> + 'static>>,
}
Expand description

A themed data table with sortable column headers.

Sorting is controlled: clicking a sortable header invokes on_sort with the column key and the requested direction, and the current order is reflected back through the sorted_by signal (exposed to assistive technology via aria-sort). Rows are (id, cells) pairs; clicking a row invokes on_row_click with its id.

Fields§

§columns: LocalBoxSignalVec<'static, TableColumn>§rows: LocalBoxSignalVec<'static, (String, Vec<Dom>)>§sorted_by: LocalBoxSignal<'static, Option<(String, SortDirection)>>§on_sort: Box<dyn Fn(String, SortDirection) + 'static>§on_row_click: Box<dyn Fn(String) + 'static>§rows_clickable: bool§apply: Option<Box<dyn FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement> + 'static>>

Implementations§

Source§

impl DataTableProps

Source

pub fn new() -> Self

Source§

impl DataTableProps

Source

pub fn columns(self, v: impl Into<Vec<TableColumn>>) -> DataTableProps

Source

pub fn columns_signal_vec( self, v: impl SignalVec<Item = TableColumn> + 'static, ) -> DataTableProps

Source§

impl DataTableProps

Source

pub fn rows(self, v: impl Into<Vec<(String, Vec<Dom>)>>) -> DataTableProps

Source

pub fn rows_signal_vec( self, v: impl SignalVec<Item = (String, Vec<Dom>)> + 'static, ) -> DataTableProps

Source§

impl DataTableProps

Source

pub fn sorted_by(self, v: Option<(String, SortDirection)>) -> DataTableProps

Source

pub fn sorted_by_signal( self, v: impl Signal<Item = Option<(String, SortDirection)>> + 'static, ) -> DataTableProps

Source§

impl DataTableProps

Source

pub fn on_sort( self, v: impl Fn(String, SortDirection) + 'static, ) -> DataTableProps

Source§

impl DataTableProps

Source

pub fn on_row_click(self, v: impl Fn(String) + 'static) -> DataTableProps

Source§

impl DataTableProps

Source

pub fn rows_clickable(self, v: bool) -> DataTableProps

Set when row clicks are meaningful; adds hover/cursor affordances

Source§

impl DataTableProps

Source

pub fn apply( self, v: impl FnOnce(DomBuilder<HtmlElement>) -> DomBuilder<HtmlElement> + 'static, ) -> DataTableProps

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.