pub struct Column {
pub key: SharedString,
pub name: SharedString,
pub align: TextAlign,
pub sort: Option<ColumnSort>,
pub paddings: Option<Edges<Pixels>>,
pub width: Pixels,
pub fixed: Option<ColumnFixed>,
pub resizable: bool,
pub movable: bool,
pub selectable: bool,
pub min_width: Pixels,
pub max_width: Pixels,
}Expand description
Represents a column in a table, used for initializing table columns.
Fields§
§key: SharedStringThe unique key of the column.
This is used to identify the column in the table and your data source.
In most cases, it should match the field name in your data source.
name: SharedStringThe display name of the column.
align: TextAlignThe text alignment of the column.
sort: Option<ColumnSort>The sorting behavior of the column, if any.
If None, the column is not sortable.
paddings: Option<Edges<Pixels>>The padding of the column.
width: PixelsThe width of the column.
fixed: Option<ColumnFixed>Whether the column is fixed, the fixed column will pin at the left side when scrolling horizontally.
resizable: boolWhether the column is resizable.
movable: boolWhether the column is movable.
selectable: boolWhether the column is selectable.
When true:
- In column selection mode: The entire column can be selected
- In cell selection mode: Individual cells in this column can be selected
When false:
- The column and its cells cannot be selected
- Useful for action columns (e.g., buttons, checkboxes) that shouldn’t participate in selection
min_width: PixelsThe minimum width of the column.
max_width: PixelsThe maximum width of the column.
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(key: impl Into<SharedString>, name: impl Into<SharedString>) -> Self
pub fn new(key: impl Into<SharedString>, name: impl Into<SharedString>) -> Self
Create a new column with the given key and name.
Sourcepub fn sort(self, sort: ColumnSort) -> Self
pub fn sort(self, sort: ColumnSort) -> Self
Set the column to be sortable with custom sort function, default is None (not sortable).
See also Column::sortable to enable sorting with default.
Sourcepub fn sortable(self) -> Self
pub fn sortable(self) -> Self
Set whether the column is sortable, default is true.
See also Column::sort.
Sourcepub fn descending(self) -> Self
pub fn descending(self) -> Self
Set whether the column is sort with descending order.
Sourcepub fn text_center(self) -> Self
pub fn text_center(self) -> Self
Set the text alignment of the column to center.
Sourcepub fn text_right(self) -> Self
pub fn text_right(self) -> Self
Set the alignment of the column text, default is left.
Only text_left, text_right is supported.
Sourcepub fn paddings(self, paddings: impl Into<Edges<Pixels>>) -> Self
pub fn paddings(self, paddings: impl Into<Edges<Pixels>>) -> Self
Set the padding of the column, default is None.
Sourcepub fn width(self, width: impl Into<Pixels>) -> Self
pub fn width(self, width: impl Into<Pixels>) -> Self
Set the width of the column, default is 100px.
Sourcepub fn fixed(self, fixed: impl Into<ColumnFixed>) -> Self
pub fn fixed(self, fixed: impl Into<ColumnFixed>) -> Self
Set whether the column is fixed, default is false.
Sourcepub fn fixed_left(self) -> Self
pub fn fixed_left(self) -> Self
Set whether the column is fixed on left side, default is false.
Sourcepub fn resizable(self, resizable: bool) -> Self
pub fn resizable(self, resizable: bool) -> Self
Set whether the column is resizable, default is true.
Sourcepub fn movable(self, movable: bool) -> Self
pub fn movable(self, movable: bool) -> Self
Set whether the column is movable, default is true.
Sourcepub fn selectable(self, selectable: bool) -> Self
pub fn selectable(self, selectable: bool) -> Self
Set whether the column is selectable, default is true.
When false, this column and its cells will not participate in selection:
- In column selection mode: The column header cannot be clicked to select
- In cell selection mode: Cells in this column cannot be selected
This is useful for action columns (e.g., with buttons or checkboxes) that should not be part of the selection system.
§Example
Column::new("actions", "Actions")
.width(px(100.))
.selectable(false) // Prevent selection of action buttonsTrait Implementations§
Source§impl FluentBuilder for Column
impl FluentBuilder for Column
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().