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>) -> QueryFilter<M>
pub fn new(name: impl Into<String>, label: impl Into<Text>) -> QueryFilter<M>
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>,
) -> QueryFilter<M>
pub fn option( self, label: impl Into<String>, predicate: Expr<bool>, ) -> QueryFilter<M>
Offer predicate as the option label, which is also its URL value.
Sourcepub fn option_keyed(
self,
key: impl Into<String>,
label: impl Into<Text>,
predicate: Expr<bool>,
) -> QueryFilter<M>
pub fn option_keyed( self, key: impl Into<String>, label: impl Into<Text>, predicate: Expr<bool>, ) -> QueryFilter<M>
Offer predicate as the option label, whose URL value is key: a link keeps working
when the label changes.
Sourcepub fn multiple(self) -> QueryFilter<M>
pub fn multiple(self) -> QueryFilter<M>
Choose several options: the control is a checklist, and the filter keeps the records any checked option’s predicate selects.
Trait Implementations§
Source§impl<M> Clone for QueryFilter<M>
impl<M> Clone for QueryFilter<M>
Source§fn clone(&self) -> QueryFilter<M>
fn clone(&self) -> QueryFilter<M>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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) -> Pin<Box<dyn View + 'a>>
fn control<'a>(&self, cx: &'a Cx, input: FilterInput) -> Pin<Box<dyn View + '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
value selects no predicate without being invalid.Source§fn load_control<'s, 'a>(
&'s self,
cx: &'a Cx,
input: FilterInput,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn View + 'a>>> + Send + 's>>where
'a: 's,
fn load_control<'s, 'a>(
&'s self,
cx: &'a Cx,
input: FilterInput,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn View + 'a>>> + Send + 's>>where
'a: 's,
control.