pub struct Tab {
pub key: String,
pub label: String,
pub filter: ListFilter,
}Expand description
One tab of a resource’s list page, as Filament’s Tab::make() in getTabs(): a key, a
label and the conditions the tab’s rows meet. The panel shows the number of rows the tab
matches beside its label, as in “Drafts (3)”, counted for the current search.
Fields§
§key: StringThe tab’s key: the value of the list’s tab query parameter, as Filament’s array key
in getTabs().
label: StringThe label. make generates it from the key, as Filament does.
filter: ListFilterThe conditions the tab’s rows meet. An empty filter, as for an “All” tab, matches every row.
Implementations§
Source§impl Tab
impl Tab
Sourcepub fn make(key: impl Into<String>) -> Self
pub fn make(key: impl Into<String>) -> Self
A tab with the key key, no conditions, and the label Filament generates from the key:
_ and - become spaces and the first letter is upper case, so "needs_review" is
“Needs review”.
Sourcepub fn filter(self, filter: ListFilter) -> Self
pub fn filter(self, filter: ListFilter) -> Self
Sets the tab’s conditions, as Filament’s modifyQueryUsing().
Sourcepub fn where_eq(
self,
column: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn where_eq( self, column: impl Into<String>, value: impl Into<Value>, ) -> Self
Adds column = value to the tab’s conditions, as
modifyQueryUsing(fn ($query) => $query->where($column, $value)).
Sourcepub fn where_ne(
self,
column: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn where_ne( self, column: impl Into<String>, value: impl Into<Value>, ) -> Self
Adds column != value to the tab’s conditions.
Sourcepub fn where_in<V: Into<Value>>(
self,
column: impl Into<String>,
values: impl IntoIterator<Item = V>,
) -> Self
pub fn where_in<V: Into<Value>>( self, column: impl Into<String>, values: impl IntoIterator<Item = V>, ) -> Self
Adds column IN (values) to the tab’s conditions.
Sourcepub fn where_null(self, column: impl Into<String>) -> Self
pub fn where_null(self, column: impl Into<String>) -> Self
Adds column IS NULL to the tab’s conditions.
Sourcepub fn where_not_null(self, column: impl Into<String>) -> Self
pub fn where_not_null(self, column: impl Into<String>) -> Self
Adds column IS NOT NULL to the tab’s conditions.
Trait Implementations§
impl Eq for Tab
impl StructuralPartialEq for Tab
Auto Trait Implementations§
impl Forget for Tab
impl Freeze for Tab
impl Move for Tab
impl RefUnwindSafe for Tab
impl Send for Tab
impl Sync for Tab
impl Unpin for Tab
impl UnsafeUnpin for Tab
impl UnwindSafe for Tab
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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