pub struct DataTableColumn {
pub key: String,
pub header: Option<String>,
pub label: Option<String>,
pub sort: Option<DataTableSortType>,
pub sortable: bool,
pub numeric: Option<bool>,
pub wide: bool,
pub record: Option<TableRecordSlot>,
pub secondary: bool,
pub render: Option<Callback<(DataTableCell, DataTableRow), Element>>,
}Expand description
One column of a DataTable.
Fields§
§key: StringUnique key into each row’s cells.
header: Option<String>Header text. Falls back to label, then the key.
label: Option<String>Alternative header text.
sort: Option<DataTableSortType>Comparison used for sorting; None renders no sort type and compares text.
sortable: boolLets users sort by this column.
numeric: Option<bool>Numeric presentation independent of sorting; None follows numeric sort type.
wide: boolGives the column extra room: an alias of record: Some(TableRecordSlot::Wide), which
record overrides.
record: Option<TableRecordSlot>The column’s place in a stacked record card. Only the first Title column is the title.
Without one, the first column without a slot that isn’t secondary becomes the title.
secondary: boolHides the column while a Records or Condensed table is narrow; the title cell repeats
its value. A table without a title column keeps it visible.
render: Option<Callback<(DataTableCell, DataTableRow), Element>>Rich cell content; sorting still uses the cell value.
Implementations§
Source§impl DataTableColumn
impl DataTableColumn
Sourcepub fn new(key: impl Into<String>, header: impl Into<String>) -> Self
pub fn new(key: impl Into<String>, header: impl Into<String>) -> Self
A column with a key and header text.
Sourcepub fn numeric(self, numeric: bool) -> Self
pub fn numeric(self, numeric: bool) -> Self
Chooses end-aligned tabular figures independently of sorting.
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Resolved presentation, retaining the legacy numeric-sort default.
Sourcepub fn sortable(self, sort: DataTableSortType) -> Self
pub fn sortable(self, sort: DataTableSortType) -> Self
Makes the column sortable with the given comparison.
Sourcepub fn sortable_text(self) -> Self
pub fn sortable_text(self) -> Self
Makes the column sortable as text without rendering a sort type.
Sourcepub fn record(self, slot: TableRecordSlot) -> Self
pub fn record(self, slot: TableRecordSlot) -> Self
Places the column’s cells in a stacked record card: the title line, its trailing end, row actions, a muted meta line, or a full-width line.
Sourcepub fn secondary(self) -> Self
pub fn secondary(self) -> Self
Hides the column while the table is narrow and repeats its value under the title.
Sourcepub fn record_slot(&self) -> Option<TableRecordSlot>
pub fn record_slot(&self) -> Option<TableRecordSlot>
The column’s own record slot: record, else Wide for a wide column.
Sourcepub fn with_render(
self,
render: Callback<(DataTableCell, DataTableRow), Element>,
) -> Self
pub fn with_render( self, render: Callback<(DataTableCell, DataTableRow), Element>, ) -> Self
Renders rich cell content.
Trait Implementations§
Source§impl Clone for DataTableColumn
impl Clone for DataTableColumn
Source§impl PartialEq for DataTableColumn
impl PartialEq for DataTableColumn
impl StructuralPartialEq for DataTableColumn
Auto Trait Implementations§
impl !RefUnwindSafe for DataTableColumn
impl !Send for DataTableColumn
impl !Sync for DataTableColumn
impl !UnwindSafe for DataTableColumn
impl Forget for DataTableColumn
impl Freeze for DataTableColumnwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
&'static UnsyncStorage: Freeze,
NonZero<u64>: Freeze,
&'static Location<'static>: Freeze,
PhantomData<Option<ExternalListenerCallback<(DataTableCell, DataTableRow), Result<VNode, RenderError>>>>: Freeze,
impl Move for DataTableColumn
impl Unpin for DataTableColumn
impl UnsafeUnpin for DataTableColumnwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
&'static UnsyncStorage: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
&'static Location<'static>: UnsafeUnpin,
PhantomData<Option<ExternalListenerCallback<(DataTableCell, DataTableRow), Result<VNode, RenderError>>>>: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
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