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
].
- The data to be rendered in this table.
This must implement
- scroll_container: [
ScrollEl
]- The container element which has scrolling capabilities.
§Optional Props
- on_change:
impl Into<EventHandler<ChangeEvent<Row>>>
- Event handler for when a row is edited. Check out the editable example.
- selection:
impl Into<Selection>
-
Selection mode together with the
RwSignal
to hold the selection. Available modes areNone
- No selection (default)Single
- Single selectionMultiple
- Multiple selection
Please see
Selection
for more information and check out the selectable example.
-
- on_selection_change:
impl Into<EventHandler<SelectionChangeEvent<Row>>>
- Event handler callback for when the selection changes. See the selectable example for details.
- thead_renderer:
impl Into<WrapperRendererFn>
- Renderer function for the table head. Defaults to
DefaultTableHeadRenderer
. For a full example see the custom_renderers_svg example.
- Renderer function for the table head. Defaults to
- tbody_renderer:
impl Into<TbodyRendererFn>
- Renderer function for the table body. Defaults to
DefaultTableBodyRenderer
. For a full example see the custom_renderers_svg example.
- Renderer function for the table body. Defaults to
- thead_row_renderer:
impl Into<WrapperRendererFn>
- Renderer function for the table head row. Defaults to
DefaultTableHeadRowRenderer
. For a full example see the custom_renderers_svg example.
- Renderer function for the table head row. Defaults to
- row_renderer:
impl Into<RowRendererFn<Row>>
- The row renderer. Defaults to
DefaultTableRowRenderer
. For a full example see the custom_renderers_svg example.
- The row renderer. Defaults to
- loading_row_renderer:
impl Into<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.
- The row renderer for when that row is currently being loaded.
Defaults to
- error_row_renderer:
impl Into<ErrorRowRendererFn>
- The row renderer for when that row failed to load.
Defaults to
DefaultErrorRowRenderer
. For a full example see the custom_renderers_svg example.
- The row renderer for when that row failed to load.
Defaults to
- row_placeholder_renderer:
impl Into<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.
- The row placeholder renderer. Defaults to
- row_class:
impl Into<Signal<String>>
- Additional classes to add to rows
- thead_class:
impl Into<Signal<String>>
- Additional classes to add to the thead
- thead_row_class:
impl Into<Signal<String>>
- Additional classes to add to the row inside the thead
- tbody_class:
impl Into<Signal<String>>
- Additional classes to add to the tbody
- loading_cell_class:
impl Into<Signal<String>>
- Additional classes to add to the cell inside a row that is being loaded
- loading_cell_inner_class:
impl Into<Signal<String>>
- Additional classes to add to the inner element inside a cell that is inside a row that is being loaded
- sorting: [
impl Into<RwSignal<VecDeque<(usize, ColumnSort)>>>
](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.
- The sorting to apply to the table.
For this to work you have add
- 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.
- The sorting mode to use. Defaults to
- on_row_count:
impl Into<EventHandler<usize>>
-
This is called once the number of rows is known. It will only be executed if
TableDataProvider::row_count
returnsSome(...)
.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:
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.
- The maximum number of loading rows to display. Defaults to
- row_reader:
RowReader<Row>
- Provides access to the data rows.
- _marker: [
PhantomData<(Err, ScrollM)>
]
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 selectionMultiple
- 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,
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,
Sourcepub fn builder() -> TableContentPropsBuilder<Row, DataP, Err, ClsP, ScrollEl, ScrollM, ((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
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,
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,
Auto Trait Implementations§
impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> Freeze for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
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>
impl<Row, DataP, Err, ClsP, ScrollEl, ScrollM> !UnwindSafe for TableContentProps<Row, DataP, Err, ClsP, ScrollEl, ScrollM>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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