pub struct QueryFilter<M> { /* private fields */ }Expand description
A filter offering named predicates, such as an embedded-enum variant or any query the app
names. Several values match a record any of their predicates selects, which
multiple lets the control choose. A filter whose predicates read a field
field_access hides from the user does not show to them:
the panel reads the fields off the predicates.
QueryFilter::new("promoted", "Promoted")
.option("Promoted", Post::fields().featured().eq(true))
.option_keyed(
"backlog",
"In the backlog",
Post::fields().featured().eq(false),
);Implementations§
Source§impl<M> QueryFilter<M>where
M: Model,
impl<M> QueryFilter<M>where
M: Model,
Sourcepub fn new(name: impl Into<String>, label: impl Into<Text>) -> Self
pub fn new(name: impl Into<String>, label: impl Into<Text>) -> Self
A filter whose URL parameter is name and whose control reads label, with no option
yet.
Sourcepub fn option(self, label: impl Into<String>, predicate: Expr<bool>) -> Self
pub fn option(self, label: impl Into<String>, predicate: Expr<bool>) -> Self
Offer predicate as the option label, which is also its URL value.
Trait Implementations§
Source§impl<M> Clone for QueryFilter<M>
impl<M> Clone for QueryFilter<M>
Source§impl<M> Debug for QueryFilter<M>
impl<M> Debug for QueryFilter<M>
Source§impl<M> Filter<M> for QueryFilter<M>
impl<M> Filter<M> for QueryFilter<M>
Source§fn to_expr(&self, _cx: &Cx, value: &FilterValue) -> Option<Expr<bool>>
fn to_expr(&self, _cx: &Cx, value: &FilterValue) -> Option<Expr<bool>>
Any of the values’ predicates; None when one names no option, or when the value names a
part.
Source§fn control<'a>(&self, cx: &'a Cx, input: FilterInput) -> BoxView<'a>
fn control<'a>(&self, cx: &'a Cx, input: FilterInput) -> BoxView<'a>
A select over the option labels, or a checklist when the filter is
multiple.
Source§fn is_noop_value(&self, _value: &FilterValue) -> bool
fn is_noop_value(&self, _value: &FilterValue) -> bool
Whether
value selects no predicate without being invalid.Source§fn load_control<'s, 'a: 's>(
&'s self,
cx: &'a Cx,
input: FilterInput,
) -> ControlFuture<'s, 'a>
fn load_control<'s, 'a: 's>( &'s self, cx: &'a Cx, input: FilterInput, ) -> ControlFuture<'s, 'a>
The control in the filter menu once what it offers has loaded, such as rows a query
returns. The filter menu renders this one; it defaults to
control.impl<M> IntoFilters<M> for QueryFilter<M>
Auto Trait Implementations§
impl<M> Freeze for QueryFilter<M>
impl<M> RefUnwindSafe for QueryFilter<M>where
M: RefUnwindSafe,
impl<M> Send for QueryFilter<M>where
M: Send,
impl<M> Sync for QueryFilter<M>where
M: Sync,
impl<M> Unpin for QueryFilter<M>where
M: Unpin,
impl<M> UnsafeUnpin for QueryFilter<M>
impl<M> UnwindSafe for QueryFilter<M>where
M: UnwindSafe,
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
Mutably borrows from an owned value. Read more