pub struct TableColumn<T: PartialEq + 'static, S: View, 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: PartialEq + 'static, S: View, K: Clone + PartialEq + Send + Sync + 'static> TableColumn<T, S, K>
impl<T: PartialEq + 'static, S: View, K: Clone + PartialEq + Send + Sync + 'static> 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,
) -> Self
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, ) -> Self
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 resizable(self, resizable: bool) -> Self
pub fn resizable(self, resizable: bool) -> Self
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§
Auto 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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.