pub struct TableColumn<T, S, K = String>{
pub key: K,
pub width: Signal<f32>,
pub min_width: Signal<f32>,
pub sortable: Signal<bool>,
pub resizable: Signal<bool>,
pub hidden: Signal<bool>,
pub cell_content: Rc<dyn Fn(&mut Context, Memo<T>)>,
pub header_content: Rc<dyn Fn(&mut Context, Memo<TableSortDirection>) -> Handle<'_, S>>,
}Expand description
Describes a table column.
Fields§
§key: KStable identity used to preserve state across reactive column updates.
width: Signal<f32>Initial width in logical pixels.
min_width: Signal<f32>Minimum width in logical pixels when resized.
sortable: Signal<bool>Whether this column can trigger sorting.
resizable: Signal<bool>Whether this column can be resized when table resizing is enabled.
Whether this column is hidden from layout and rendering.
cell_content: Rc<dyn Fn(&mut Context, Memo<T>)>Custom cell content builder.
header_content: Rc<dyn Fn(&mut Context, Memo<TableSortDirection>) -> Handle<'_, S>>Custom header content builder.
Implementations§
Source§impl<T, S, K> TableColumn<T, S, K>
impl<T, S, K> TableColumn<T, S, K>
Sourcepub fn new(
key: impl Into<K>,
header_content: impl Fn(&mut Context, Memo<TableSortDirection>) -> Handle<'_, S> + 'static,
cell_content: impl Fn(&mut Context, Memo<T>) + 'static,
) -> TableColumn<T, S, K>
pub fn new( key: impl Into<K>, header_content: impl Fn(&mut Context, Memo<TableSortDirection>) -> Handle<'_, S> + 'static, cell_content: impl Fn(&mut Context, Memo<T>) + 'static, ) -> TableColumn<T, S, K>
Creates a new table column from explicit header and cell builders.
Use this when you need full control over header and cell rendering.
TableColumn::new(
"status",
|cx, sort_direction| TableHeader::new(cx, "Status", sort_direction),
|cx, row| {
let status = row.map(|row: &RowData| row.status.clone());
Label::new(cx, status).class("table-cell-text");
},
)
.resizable(true)
.sortable(true);Sourcepub fn width(self, width: f32) -> TableColumn<T, S, K>
pub fn width(self, width: f32) -> TableColumn<T, S, K>
Sets the initial width.
Sourcepub fn min_width(self, min_width: f32) -> TableColumn<T, S, K>
pub fn min_width(self, min_width: f32) -> TableColumn<T, S, K>
Sets the minimum width.
Sourcepub fn sortable(self, sortable: bool) -> TableColumn<T, S, K>
pub fn sortable(self, sortable: bool) -> TableColumn<T, S, K>
Sets whether this column can trigger sorting.
Sourcepub fn resizable(self, resizable: bool) -> TableColumn<T, S, K>
pub fn resizable(self, resizable: bool) -> TableColumn<T, S, K>
Sets whether this column can be resized when table resizing is enabled.
Sets whether this column is hidden from layout and rendering.
Binds hidden state to an external resource.
Trait Implementations§
Source§impl<T, S, K> Clone for TableColumn<T, S, K>
impl<T, S, K> Clone for TableColumn<T, S, K>
Source§fn clone(&self) -> TableColumn<T, S, K>
fn clone(&self) -> TableColumn<T, S, K>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<T, S, K> Freeze for TableColumn<T, S, K>where
K: Freeze,
impl<T, S, K = String> !RefUnwindSafe for TableColumn<T, S, K>
impl<T, S, K = String> !Send for TableColumn<T, S, K>
impl<T, S, K = String> !Sync for TableColumn<T, S, K>
impl<T, S, K> Unpin for TableColumn<T, S, K>where
K: Unpin,
impl<T, S, K> UnsafeUnpin for TableColumn<T, S, K>where
K: UnsafeUnpin,
impl<T, S, K = String> !UnwindSafe for TableColumn<T, S, K>
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> 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.