pub struct CountColumn<M> { /* private fields */ }Expand description
A column counting the records of a Deferred has_many field that a source S shows, which
declares the field’s include so every page that renders it loads the records.
use tablo_core::{CountColumn, relation};
CountColumn::of::<CommentResource>(relation!(Post.comments));The header and the column’s name are the field’s name, capitalized, until
label replaces both.
The count is how many of the loaded records S shows the user, which RelationColumn
decides the same way: a page loads every related record of every row it counts.
unscoped counts every record the include loads.
Implementations§
Source§impl<M> CountColumn<M>
impl<M> CountColumn<M>
Sourcepub fn of<S>(relation: RelationLens<M, Deferred<Vec<S::Model>>>) -> Selfwhere
S: OptionSource,
pub fn of<S>(relation: RelationLens<M, Deferred<Vec<S::Model>>>) -> Selfwhere
S: OptionSource,
Declare a column counting the records relation loads that S shows.
Source§impl<M> CountColumn<M>
impl<M> CountColumn<M>
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
Replace the label the field’s name gives it, and name the column after the label,
as a ComputedColumn is: two columns over one relation
need two labels.
Sourcepub fn width(self, width: ColumnWidth) -> Self
pub fn width(self, width: ColumnWidth) -> Self
Declare this column’s width.
Sourcepub fn toggleable(self) -> Self
pub fn toggleable(self) -> Self
Let each reader hide this column from their list; it starts shown.
Let each reader show this column in their list; it starts hidden.
Trait Implementations§
Source§impl<M> Clone for CountColumn<M>
impl<M> Clone for CountColumn<M>
Source§impl<M> Column<M> for CountColumn<M>
impl<M> Column<M> for CountColumn<M>
Source§fn column_width(&self) -> ColumnWidth
fn column_width(&self) -> ColumnWidth
Source§fn toggle(&self) -> ColumnToggle
fn toggle(&self) -> ColumnToggle
Source§fn is_searchable(&self) -> bool
fn is_searchable(&self) -> bool
Source§fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
term adds.