Skip to main content

GridColumn

Struct GridColumn 

Source
pub struct GridColumn { /* private fields */ }
Expand description

A data grid column: title, width, alignment, formatting and capabilities.

Implementations§

Source§

impl GridColumn

Source

pub fn text(title: impl Into<String>) -> Self

A text column.

Source

pub fn number(title: impl Into<String>) -> Self

A right-aligned number column with thousands separators.

Source

pub fn currency(title: impl Into<String>, prefix: &str, decimals: usize) -> Self

A number column formatted as money: currency("MRR", "R$ ", 2).

Source

pub fn boolean(title: impl Into<String>) -> Self

A yes/no column.

Source

pub fn date(title: impl Into<String>) -> Self

A date column, written 2026-11-02 unless format says otherwise.

Source

pub fn field(self, field: impl Into<String>) -> Self

The name of the field this column shows, which stays when the title is translated.

Source

pub fn field_name(&self) -> Option<&str>

The name given by field.

Source

pub fn width(self, width: f32) -> Self

Sets the width in logical pixels, never below the column’s minimum.

Source

pub fn resizable(self, resizable: bool) -> Self

Whether people can change the width, by the handle or the column’s menu (they can by default). With false, it keeps the width it has been given, or what a Self::fill column gets from the room left.

Source

pub fn align(self, align: CellAlign) -> Self

Sets the cell alignment.

Source

pub fn number_format(self, format: NumberFormat) -> Self

Decimal places and separators for number columns.

Source

pub fn summary(self, summary: Summary) -> Self

Shows this aggregate in group rows and the footer.

Source

pub fn sortable(self, sortable: bool) -> Self

Whether clicking the header sorts by this column (default true).

Source

pub fn filterable(self, filterable: bool) -> Self

Whether the filter row has a field for this column (default true).

Source

pub fn groupable(self, groupable: bool) -> Self

Whether rows can be grouped by this column (default true).

Source

pub fn editable(self) -> Self

Cells can be edited (double-click, Enter or F2).

Source

pub fn summary_formula(self, formula: impl Into<String>) -> Self

Works out the summary of the group rows and the footer with a formula over their rows, in place of summary, such as Sum([Seats]) / Count(). Columns go by their titles.

Source

pub fn pinned(self, pinned: bool) -> Self

Stays in place at the left while the others scroll sideways.

Source

pub fn fill(self) -> Self

Takes the width the columns leave over, so a wide window has no empty stretch at the end of the rows. Its Self::width is what it never goes below.

Source

pub fn hidden(self) -> Self

Starts hidden; users can show it from the column chooser.

Source

pub fn format(self, f: impl Fn(&Value) -> String + 'static) -> Self

Custom text for each value (also used by filtering, search and export).

Source

pub fn template(self, f: impl Fn(&Value) -> AnyView + 'static) -> Self

Custom view for each cell (a badge, an avatar…).

Source

pub fn title(&self) -> &str

The header title.

Source

pub fn display(&self, value: &Value) -> String

The text shown for value.

Source

pub fn display_summary(&self, summary: Summary, value: f64) -> String

Formats an aggregate of this column.

Source

pub fn parse(&self, text: &str, previous: &Value) -> Value

Parses edited text into a value of this column’s kind.

Trait Implementations§

Source§

impl Clone for GridColumn

Source§

fn clone(&self) -> GridColumn

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridColumn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

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

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