pub struct DataGridColumn<E: Model, T> { /* private fields */ }Expand description
Configures the last added column. DataGrid methods can be called from here too.
Implementations§
Source§impl<E: Model, T> DataGridColumn<E, T>
impl<E: Model, T> DataGridColumn<E, T>
Sourcepub fn no_sort(self) -> Self
pub fn no_sort(self) -> Self
The column cannot be sorted: the header has no sort button, the column menu no sort entries, and the server drops sort keys on it before the action runs. Use it when the action cannot order by the field (generated rows, a column the database has no index for), so the page never offers a sort the data does not follow.
Sourcepub fn sum(self) -> Selfwhere
T: SupportsSum,
pub fn sum(self) -> Selfwhere
T: SupportsSum,
Shows the column total in the footer, computed on the server over every matching row. Compiles only on numeric and money columns.
Sourcepub fn avg(self) -> Selfwhere
T: SupportsSum,
pub fn avg(self) -> Selfwhere
T: SupportsSum,
Shows the column average in the footer. Compiles only on numeric and money columns.
Sourcepub fn min(self) -> Selfwhere
T: SupportsMinMaxTotal,
pub fn min(self) -> Selfwhere
T: SupportsMinMaxTotal,
Shows the smallest value in the footer. Compiles on numbers, money, dates and times.
Sourcepub fn max(self) -> Selfwhere
T: SupportsMinMaxTotal,
pub fn max(self) -> Selfwhere
T: SupportsMinMaxTotal,
Shows the largest value in the footer. Compiles on numbers, money, dates and times.
Sourcepub fn pin_start(self) -> Self
pub fn pin_start(self) -> Self
Keeps the column at the start edge (left in left to right languages) while the grid scrolls sideways. At most three columns per side stay pinned.
Leaves the column out until the user shows it from the column menu.
Sourcepub fn editable(self) -> Self
pub fn editable(self) -> Self
Lets users edit this column in place when the grid has a save action (DataGrid::edit_with).
Keys, read only fields and row versions never become editable; the server refuses
values for them.
Sourcepub fn cell(self, renderer: impl CellRenderer<T>) -> Selfwhere
T: 'static,
pub fn cell(self, renderer: impl CellRenderer<T>) -> Selfwhere
T: 'static,
Draws the cells with a custom renderer. See CellRenderer.
Sourcepub fn badge(self, tone: impl Fn(&T) -> Tone + Send + Sync + 'static) -> Selfwhere
T: ChoiceType + FieldType + 'static,
pub fn badge(self, tone: impl Fn(&T) -> Tone + Send + Sync + 'static) -> Selfwhere
T: ChoiceType + FieldType + 'static,
Shows the choice as a colored badge; tone picks the color per option:
.badge(|u| match u { Unit::Kg => Tone::Info, _ => Tone::Neutral }). Compiles only on
#[choice] columns.
Sourcepub fn progress(self, max: i64) -> Selfwhere
T: SupportsSum + FieldType + 'static,
pub fn progress(self, max: i64) -> Selfwhere
T: SupportsSum + FieldType + 'static,
Shows a number as a bar filled up to max, with the number beside it. Compiles only on
numeric and money columns.
Sourcepub fn link(self, effect: impl Fn(&E) -> Effect + Send + Sync + 'static) -> Selfwhere
T: FieldType + 'static,
pub fn link(self, effect: impl Fn(&E) -> Effect + Send + Sync + 'static) -> Selfwhere
T: FieldType + 'static,
Makes the cell a link that runs an effect built from the row, such as opening a window.
Sourcepub fn check_icon(self) -> Self
pub fn check_icon(self) -> Self
Shows yes as a check mark and no as a dash, with the words for screen readers. Compiles only on yes/no columns.
Sourcepub fn relative_time(self) -> Self
pub fn relative_time(self) -> Self
Shows a moment as relative time (“3 minutes ago”) in the user’s language, with the exact time in the user’s time zone as a tooltip. Compiles only on moment columns.
Sourcepub fn count(self) -> Self
pub fn count(self) -> Self
Shows how many matching rows have a value in this column. Works on every column.