pub struct Column { /* private fields */ }Expand description
A column of a resource’s table: which value of a record it shows, and how.
Implementations§
Source§impl Column
impl Column
Sourcepub fn text(name: impl Into<String>) -> Self
pub fn text(name: impl Into<String>) -> Self
A column of plain text.
A column’s name is a field of the serialized model. To show a value of a related model,
load the relationship in AdminResource::query and name
the column with a dotted path, such as Column::text("customer.name"). The database
can’t sort or search by such a column.
Sourcepub fn badge(name: impl Into<String>) -> Self
pub fn badge(name: impl Into<String>) -> Self
A column that shows its value as a colored badge, for a status or another small set of
values. Give each value a color with color.
Sourcepub fn boolean(name: impl Into<String>) -> Self
pub fn boolean(name: impl Into<String>) -> Self
A column that shows a bool as a check mark or a dash.
Sourcepub fn number(name: impl Into<String>) -> Self
pub fn number(name: impl Into<String>) -> Self
A right-aligned column for a number, shown with thousands separators.
Sourcepub fn currency(
name: impl Into<String>,
currency_code: impl Into<String>,
) -> Self
pub fn currency( name: impl Into<String>, currency_code: impl Into<String>, ) -> Self
A right-aligned column for an amount of money in the given currency, such as
Column::currency("total", "USD").
Sourcepub fn datetime(name: impl Into<String>) -> Self
pub fn datetime(name: impl Into<String>) -> Self
A column for an instant, shown as a date and a time in the user’s time zone.
Sourcepub fn relative_time(name: impl Into<String>) -> Self
pub fn relative_time(name: impl Into<String>) -> Self
A column for an instant, shown as how long ago it was, such as 3 hours ago. Hovering
over it shows the date and time.
Sourcepub fn avatar(name: impl Into<String>) -> Self
pub fn avatar(name: impl Into<String>) -> Self
A column that shows a name beside a circle with its initials. Add a second line under the
name with description_column.
A column that shows a list of short values as badges.
Sourcepub fn json(name: impl Into<String>) -> Self
pub fn json(name: impl Into<String>) -> Self
A column that shows the start of a JSON value in a monospace font.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Sets the column’s heading. By default it’s the column’s name in words.
Sourcepub fn align(self, align: ColumnAlign) -> Self
pub fn align(self, align: ColumnAlign) -> Self
Sets which side of the column its values line up on.
Sourcepub fn sortable(self) -> Self
pub fn sortable(self) -> Self
Lets the user sort the table by this column, by clicking its heading.
Sourcepub fn searchable(self) -> Self
pub fn searchable(self) -> Self
Looks in this column when the user searches the table, or the whole panel with ⌘K. The column must hold text.
Sourcepub fn toggleable(self, toggleable: bool) -> Self
pub fn toggleable(self, toggleable: bool) -> Self
Sets whether the user may hide the column from the table’s Columns menu. They may by
default.
Leaves the column out of the table until the user turns it on from the Columns menu.
Sourcepub fn copyable(self) -> Self
pub fn copyable(self) -> Self
Shows a button beside the value, on hover, that copies it to the clipboard.
Sourcepub fn mono(self) -> Self
pub fn mono(self) -> Self
Shows the value in a monospace font, for an identifier such as a SKU. A number column also drops its thousands separators.
Sourcepub fn prefix(self, prefix: impl Into<String>) -> Self
pub fn prefix(self, prefix: impl Into<String>) -> Self
Sets text shown before the value, such as #.
Sourcepub fn suffix(self, suffix: impl Into<String>) -> Self
pub fn suffix(self, suffix: impl Into<String>) -> Self
Sets text shown after the value, such as %.
Sourcepub fn description_column(self, column: impl Into<String>) -> Self
pub fn description_column(self, column: impl Into<String>) -> Self
Shows another field’s value in smaller text under this column’s value, such as an email under a name.
Sourcepub fn limit(self, chars: usize) -> Self
pub fn limit(self, chars: usize) -> Self
Shortens text longer than this many characters, ending it with an ellipsis.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Column
impl Freeze for Columnwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, BadgeColor> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, BadgeColor)>>: Freeze,
impl Move for Column
impl RefUnwindSafe for Column
impl Send for Columnwhere
RawVecInner: Send,
NodeRef<Owned, String, BadgeColor, LeafOrInternal>: Send,
BoxRaw<(String, BadgeColor)>: Send,
impl Sync for Columnwhere
RawVecInner: Sync,
NodeRef<Owned, String, BadgeColor, LeafOrInternal>: Sync,
BoxRaw<(String, BadgeColor)>: Sync,
impl Unpin for Column
impl UnsafeUnpin for Columnwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, BadgeColor> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, BadgeColor)>>: UnsafeUnpin,
impl UnwindSafe for Column
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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