pub struct Column<T: 'static> { /* private fields */ }Expand description
Single column declaration. Column ids must be stable, unique strings — they’re the persistence key for sort, filter, width, and ordering.
Implementations§
Source§impl<T: 'static> Column<T>
impl<T: 'static> Column<T>
Sourcepub fn new(
id: impl Into<String>,
header: impl Into<LocalizedString>,
cell: impl Fn(&T, &CellContext) -> Box<dyn Widget> + 'static,
) -> Self
pub fn new( id: impl Into<String>, header: impl Into<LocalizedString>, cell: impl Fn(&T, &CellContext) -> Box<dyn Widget> + 'static, ) -> Self
Create a column with a stable id, a localized header label, and a
cell builder that takes &T plus a CellContext and returns a
boxed widget.
pub fn width(self, w: ColumnWidth) -> Self
pub fn min_width(self, px: f32) -> Self
pub fn max_width(self, px: f32) -> Self
pub fn alignment(self, a: Alignment) -> Self
pub fn resizable(self, b: bool) -> Self
pub fn reorderable(self, b: bool) -> Self
pub fn sortable(self, b: bool) -> Self
pub fn filterable(self, b: bool) -> Self
Sourcepub fn editable(self, b: bool) -> Self
pub fn editable(self, b: bool) -> Self
Mark the column as editable. Default false. F2 / type-to-edit
only enter edit mode on cells of editable columns; the
on_cell_edit_request hook also fires only for these. Cells of
non-editable columns continue to render their static delegate
regardless of editing_cell.
Sourcepub fn edit_triggers(self, triggers: EditTriggers) -> Self
pub fn edit_triggers(self, triggers: EditTriggers) -> Self
Override the view’s EditTriggers for this column alone.
The reason the set is not only table-wide: a table’s columns rarely want the same gesture. A tree column has to keep click-to-select and double-click-to-open, while the plain value columns beside it are exactly where one click to edit belongs. Unset columns inherit the view’s set.
Sourcepub fn effective_edit_triggers(&self, view: EditTriggers) -> EditTriggers
pub fn effective_edit_triggers(&self, view: EditTriggers) -> EditTriggers
The triggers in force for this column, given the view’s set — the question the body pane and the key handler both ask, and the one an application’s own tests want to ask about their column set.
A non-editable column never opens an editor, whatever either says.
pub fn pinned(self, side: PinnedSide) -> Self
pub fn truncation(self, p: TruncationPolicy) -> Self
Sourcepub fn header_override(
self,
f: impl Fn(&ColumnContext) -> Box<dyn Widget> + 'static,
) -> Self
pub fn header_override( self, f: impl Fn(&ColumnContext) -> Box<dyn Widget> + 'static, ) -> Self
Override the default header rendering (label + sort/filter
indicators). The closure receives a ColumnContext reflecting
the current sort/filter state.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Column<T>
impl<T> !Send for Column<T>
impl<T> !Sync for Column<T>
impl<T> !UnwindSafe for Column<T>
impl<T> Freeze for Column<T>
impl<T> Unpin for Column<T>
impl<T> UnsafeUnpin for Column<T>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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