leptos_struct_table

Struct TableContentProps

Source
pub struct TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
where Row: TableRow<ClassesProvider = ClsP> + Clone + Send + Sync + 'static, DataP: TableDataProvider<Row, Err> + 'static, Err: Debug, ClsP: TableClassesProvider + Send + Sync + Copy + 'static, ScrollEl: IntoElementMaybeSignal<Element, ScrollM>, ScrollM: ?Sized,
{
Show 26 fields pub rows: DataP, pub scroll_container: ScrollEl, pub on_change: EventHandler<ChangeEvent<Row>>, pub selection: Selection, pub on_selection_change: EventHandler<SelectionChangeEvent<Row>>, pub thead_renderer: WrapperRendererFn, pub tbody_renderer: TbodyRendererFn, pub thead_row_renderer: WrapperRendererFn, pub row_renderer: RowRendererFn<Row>, pub loading_row_renderer: LoadingRowRendererFn, pub error_row_renderer: ErrorRowRendererFn, pub row_placeholder_renderer: RowPlaceholderRendererFn, pub row_class: Signal<String>, pub thead_class: Signal<String>, pub thead_row_class: Signal<String>, pub tbody_class: Signal<String>, pub loading_cell_class: Signal<String>, pub loading_cell_inner_class: Signal<String>, pub sorting: RwSignal<VecDeque<(usize, ColumnSort)>>, pub sorting_mode: SortingMode, pub on_row_count: EventHandler<usize>, pub reload_controller: ReloadController, pub display_strategy: DisplayStrategy, pub loading_row_display_limit: Option<usize>, pub row_reader: RowReader<Row>, pub _marker: PhantomData<(Err, ScrollM)>,
}
Expand description

Props for the TableContent component.

Render the content of a table. This is the main component of this crate.

§Required Props

  • rows: [DataP]
    • The data to be rendered in this table. This must implement TableDataProvider or [PaginatedTableDataProvider].
  • scroll_container: [ScrollEl]
    • The container element which has scrolling capabilities.

§Optional Props

Fields§

§rows: DataP

The data to be rendered in this table. This must implement TableDataProvider or [PaginatedTableDataProvider].

§scroll_container: ScrollEl

The container element which has scrolling capabilities.

§on_change: EventHandler<ChangeEvent<Row>>

Event handler for when a row is edited. Check out the editable example.

§selection: Selection

Selection mode together with the RwSignal to hold the selection. Available modes are

  • None - No selection (default)
  • Single - Single selection
  • Multiple - Multiple selection

Please see Selection for more information and check out the selectable example.

§on_selection_change: EventHandler<SelectionChangeEvent<Row>>

Event handler callback for when the selection changes. See the selectable example for details.

§thead_renderer: WrapperRendererFn

Renderer function for the table head. Defaults to DefaultTableHeadRenderer. For a full example see the custom_renderers_svg example.

§tbody_renderer: TbodyRendererFn

Renderer function for the table body. Defaults to DefaultTableBodyRenderer. For a full example see the custom_renderers_svg example.

§thead_row_renderer: WrapperRendererFn

Renderer function for the table head row. Defaults to DefaultTableHeadRowRenderer. For a full example see the custom_renderers_svg example.

§row_renderer: RowRendererFn<Row>

The row renderer. Defaults to DefaultTableRowRenderer. For a full example see the custom_renderers_svg example.

§loading_row_renderer: LoadingRowRendererFn

The row renderer for when that row is currently being loaded. Defaults to DefaultLoadingRowRenderer. For a full example see the custom_renderers_svg example.

§error_row_renderer: ErrorRowRendererFn

The row renderer for when that row failed to load. Defaults to DefaultErrorRowRenderer. For a full example see the custom_renderers_svg example.

§row_placeholder_renderer: RowPlaceholderRendererFn

The row placeholder renderer. Defaults to DefaultRowPlaceholderRenderer. This is used in place of rows that are not shown before and after the currently visible rows.

§row_class: Signal<String>

Additional classes to add to rows

§thead_class: Signal<String>

Additional classes to add to the thead

§thead_row_class: Signal<String>

Additional classes to add to the row inside the thead

§tbody_class: Signal<String>

Additional classes to add to the tbody

§loading_cell_class: Signal<String>

Additional classes to add to the cell inside a row that is being loaded

§loading_cell_inner_class: Signal<String>

Additional classes to add to the inner element inside a cell that is inside a row that is being loaded

§sorting: RwSignal<VecDeque<(usize, ColumnSort)>>

The sorting to apply to the table. For this to work you have add #[table(sortable)] to your struct. Please see the simple example.

§sorting_mode: SortingMode

The sorting mode to use. Defaults to MultiColumn. Please note that this to have any effect you have to add the macro attribute #[table(sortable)] to your struct.

§on_row_count: EventHandler<usize>

This is called once the number of rows is known. It will only be executed if TableDataProvider::row_count returns Some(...).

See the paginated_rest_datasource example for how to use.

§reload_controller: ReloadController

Allows to manually trigger a reload.

See the paginated_rest_datasource example for how to use.

§display_strategy: DisplayStrategy

The display strategy to use when rendering the table. Can be one of

  • Virtualization
  • InfiniteScroll
  • Pagination

Please check DisplayStrategy to see explanations of all available options.

§loading_row_display_limit: Option<usize>

The maximum number of loading rows to display. Defaults to None which means unlimited. Use this if you load a small number of rows and don’t want the entire screen to be full of loading rows.

§row_reader: RowReader<Row>

Provides access to the data rows.

§_marker: PhantomData<(Err, ScrollM)>

Implementations§

Source§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
where Row: TableRow<ClassesProvider = ClsP> + Clone + Send + Sync + 'static, DataP: TableDataProvider<Row, Err> + 'static, Err: Debug, ClsP: TableClassesProvider + Send + Sync + Copy + 'static, ScrollEl: IntoElementMaybeSignal<Element, ScrollM>, ScrollM: ?Sized,

Source

pub fn builder() -> TableContentPropsBuilder<Row, DataP, Err, ClsP, ScrollEl, ScrollM, ((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building TableContentProps. On the builder, call .rows(...), .scroll_container(...), .on_change(...)(optional), .selection(...)(optional), .on_selection_change(...)(optional), .thead_renderer(...)(optional), .tbody_renderer(...)(optional), .thead_row_renderer(...)(optional), .row_renderer(...)(optional), .loading_row_renderer(...)(optional), .error_row_renderer(...)(optional), .row_placeholder_renderer(...)(optional), .row_class(...)(optional), .thead_class(...)(optional), .thead_row_class(...)(optional), .tbody_class(...)(optional), .loading_cell_class(...)(optional), .loading_cell_inner_class(...)(optional), .sorting(...)(optional), .sorting_mode(...)(optional), .on_row_count(...)(optional), .reload_controller(...)(optional), .display_strategy(...)(optional), .loading_row_display_limit(...)(optional), .row_reader(...)(optional), ._marker(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of TableContentProps.

Trait Implementations§

Source§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> Props for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
where Row: TableRow<ClassesProvider = ClsP> + Clone + Send + Sync + 'static, DataP: TableDataProvider<Row, Err> + 'static, Err: Debug, ClsP: TableClassesProvider + Send + Sync + Copy + 'static, ScrollEl: IntoElementMaybeSignal<Element, ScrollM>, ScrollM: ?Sized,

Source§

type Builder = TableContentPropsBuilder<Row, DataP, Err, ClsP, ScrollEl, ScrollM>

Source§

fn builder() -> Self::Builder

Auto Trait Implementations§

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> Freeze for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
where DataP: Freeze, ScrollEl: Freeze, ScrollM: ?Sized,

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> !RefUnwindSafe for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> !Send for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> !Sync for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> Unpin for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
where DataP: Unpin, ScrollEl: Unpin, Err: Unpin, ScrollM: Unpin + ?Sized,

§

impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> !UnwindSafe for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>

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> 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<El, T, Marker> IntoElementMaybeSignal<T, Marker> for El
where El: IntoElementMaybeSignalType<T, Marker>, Marker: ?Sized,

Source§

impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for El
where El: IntoElementsMaybeSignalType<T, Marker>, Marker: ?Sized,

Source§

impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T