Skip to main content

DataGridColumn

Struct DataGridColumn 

Source
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>

Source

pub fn width(self, px: u32) -> Self

Fixed width in pixels.

Source

pub fn flex(self, weight: u32) -> Self

Takes a share of the remaining width.

Source

pub fn filter(self) -> Self

Adds a filter box to the column.

Source

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.

Source

pub fn sum(self) -> Self
where T: SupportsSum,

Shows the column total in the footer, computed on the server over every matching row. Compiles only on numeric and money columns.

Source

pub fn avg(self) -> Self
where T: SupportsSum,

Shows the column average in the footer. Compiles only on numeric and money columns.

Source

pub fn min(self) -> Self

Shows the smallest value in the footer. Compiles on numbers, money, dates and times.

Source

pub fn max(self) -> Self

Shows the largest value in the footer. Compiles on numbers, money, dates and times.

Source

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.

Source

pub fn pin_end(self) -> Self

Keeps the column at the end edge while the grid scrolls sideways.

Source

pub fn hidden(self) -> Self

Leaves the column out until the user shows it from the column menu.

Source

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.

Source

pub fn cell(self, renderer: impl CellRenderer<T>) -> Self
where T: 'static,

Draws the cells with a custom renderer. See CellRenderer.

Source

pub fn badge(self, tone: impl Fn(&T) -> Tone + Send + Sync + 'static) -> Self
where 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.

Source

pub fn progress(self, max: i64) -> Self
where 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.

Makes the cell a link that runs an effect built from the row, such as opening a window.

Source

pub fn check_icon(self) -> Self
where T: IsBool + FieldType + 'static,

Shows yes as a check mark and no as a dash, with the words for screen readers. Compiles only on yes/no columns.

Source

pub fn relative_time(self) -> Self
where T: IsMoment + FieldType + 'static,

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.

Source

pub fn count(self) -> Self

Shows how many matching rows have a value in this column. Works on every column.

Source

pub fn column<U: FieldType + 'static>( self, field: Field<E, U>, ) -> DataGridColumn<E, U>

Source

pub fn mode(self, mode: DataMode) -> DataGrid<E>

Source

pub fn paging(self, paging: Paging) -> DataGrid<E>

Source

pub fn row_style( self, style: impl Fn(&E) -> Option<RowStyle> + Send + Sync + 'static, ) -> DataGrid<E>

Source

pub fn on_open( self, open: impl Fn(&E) -> Effect + Send + Sync + 'static, ) -> DataGrid<E>

Source

pub fn row_action<A>( self, label: impl Into<Text>, action: A, input: impl Fn(&E) -> A::Input + Send + Sync + 'static, ) -> DataGrid<E>
where A: Action, A::Output: Outcome,

Source

pub fn selectable(self) -> DataGrid<E>

Source

pub fn row_menu( self, menu: impl Fn(&E) -> ContextMenu + Send + Sync + 'static, ) -> DataGrid<E>

Source

pub fn exportable(self) -> DataGrid<E>

Source

pub fn edit_with<A>(self, save: A) -> DataGrid<E>
where A: FormAction<E> + Action<Input = Valid<E>>, A::Output: Outcome,

Source

pub fn bulk_action<A, K>( self, label: impl Into<Text>, action: A, key: Field<E, K>, ) -> DataGrid<E>
where A: BulkAction<K> + Action<Input = Vec<K>>, A::Output: Outcome, K: DeserializeOwned + Send + 'static,

Source

pub fn detail<S: ScreenDef>( self, detail: impl Fn(&E) -> (S, S::Params) + Send + Sync + 'static, ) -> DataGrid<E>

Source

pub fn scope<U: FieldType>(self, field: Field<E, U>, value: U) -> DataGrid<E>

Source

pub fn sort_by<U: FieldType>( self, field: Field<E, U>, desc: bool, ) -> DataGrid<E>

Source

pub fn group_by<U: FieldType>(self, field: Field<E, U>) -> DataGrid<E>

Source

pub fn tree<K: FieldType>(self, parent: Field<E, Option<K>>) -> DataGrid<E>
where Option<K>: FieldType,

Source

pub fn done(self) -> DataGrid<E>

Returns the grid.

Trait Implementations§

Source§

impl<E: Model, T> From<DataGridColumn<E, T>> for DataGrid<E>

Source§

fn from(c: DataGridColumn<E, T>) -> Self

Converts to this type from the input type.
Source§

impl<E: Model, T> From<DataGridColumn<E, T>> for Node

Source§

fn from(c: DataGridColumn<E, T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E, T> !RefUnwindSafe for DataGridColumn<E, T>

§

impl<E, T> !UnwindSafe for DataGridColumn<E, T>

§

impl<E, T> Freeze for DataGridColumn<E, T>
where DataGrid<E>: Freeze, Field<E, T>: Freeze, PhantomData<fn() -> T>: Freeze,

§

impl<E, T> Send for DataGridColumn<E, T>
where DataGrid<E>: Send, Field<E, T>: Send, PhantomData<fn() -> T>: Send,

§

impl<E, T> Sync for DataGridColumn<E, T>
where DataGrid<E>: Sync, Field<E, T>: Sync, PhantomData<fn() -> T>: Sync,

§

impl<E, T> Unpin for DataGridColumn<E, T>
where DataGrid<E>: Unpin, Field<E, T>: Unpin, PhantomData<fn() -> T>: Unpin,

§

impl<E, T> UnsafeUnpin for DataGridColumn<E, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more