pub struct UseSorterBuilder<F> { /* private fields */ }Expand description
Builder for UseSorter. Use this to specify the field and direction of the sorter. For example by passing sort state from URL parameters.
Ordering of Self::with_field and Self::with_direction matters as the builder will ignore invalid combinations specified by the field’s Sortable. This is to prevent the user from specifying a direction that is not allowed by the field.
Implementations§
Source§impl<F: Copy + Default + Sortable> UseSorterBuilder<F>
impl<F: Copy + Default + Sortable> UseSorterBuilder<F>
Sourcepub fn with_field(&self, field: F) -> Self
pub fn with_field(&self, field: F) -> Self
Optionally sets the initial field to sort by.
Sourcepub fn with_direction(&self, direction: Direction) -> Self
pub fn with_direction(&self, direction: Direction) -> Self
Optionally sets the initial direction to sort by.Direction::Ascending can be set.
Sourcepub fn use_sorter(self, cx: &ScopeState) -> UseSorter<'_, F>
pub fn use_sorter(self, cx: &ScopeState) -> UseSorter<'_, F>
Creates Dioxus hooks to manage state. Must follow Dioxus hook rules and be called unconditionally in the same order as other hooks. See use_sorter() for simple usage.
This fn (or Self::use_sorter) must be called or never used. See the docs on UseSorter::sort on using conditions.
If the field or direction has not been set then the default values will be used.
Trait Implementations§
Source§impl<F: Clone> Clone for UseSorterBuilder<F>
impl<F: Clone> Clone for UseSorterBuilder<F>
Source§fn clone(&self) -> UseSorterBuilder<F>
fn clone(&self) -> UseSorterBuilder<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more