pub struct Table { /* private fields */ }Expand description
A data table widget with column headers, row selection, and keyboard navigation.
Implementations§
Source§impl Table
impl Table
Sourcepub fn columns(self, columns: Vec<TableColumn>) -> Self
pub fn columns(self, columns: Vec<TableColumn>) -> Self
Sets the column definitions.
Sourcepub fn rows_simple(self, rows: Vec<Vec<impl Into<TableCell>>>) -> Self
pub fn rows_simple(self, rows: Vec<Vec<impl Into<TableCell>>>) -> Self
Convenience: construct rows from Vec<Vec<impl Into
Sets a footer row displayed below all data rows.
Sourcepub fn header_style(self, style: Style) -> Self
pub fn header_style(self, style: Style) -> Self
Sets the header row style.
Sourcepub fn select_style(self, style: Style) -> Self
pub fn select_style(self, style: Style) -> Self
Sets the selected row style.
Sourcepub fn set_selected(&mut self, index: usize, cx: &mut EventCx<'_>)
pub fn set_selected(&mut self, index: usize, cx: &mut EventCx<'_>)
Sets the selected row programmatically.
Sourcepub fn sort_by_column(&mut self, col: usize, cx: &mut EventCx<'_>)
pub fn sort_by_column(&mut self, col: usize, cx: &mut EventCx<'_>)
Sorts rows by the given column index, in ascending order. Invalid column index is a no-op.
Sourcepub fn set_column_width(&mut self, col: usize, width: u16, cx: &mut EventCx<'_>)
pub fn set_column_width(&mut self, col: usize, width: u16, cx: &mut EventCx<'_>)
Sets the width of a specific column. Minimum width is 3.
Sourcepub fn adjust_column_width(
&mut self,
col: usize,
delta: i16,
cx: &mut EventCx<'_>,
)
pub fn adjust_column_width( &mut self, col: usize, delta: i16, cx: &mut EventCx<'_>, )
Adjusts the width of a column by delta (positive = wider).
Trait Implementations§
Source§impl Component for Table
impl Component for Table
Source§fn measure(&self, _constraint: Constraint, _cx: &mut MeasureCx) -> Size
fn measure(&self, _constraint: Constraint, _cx: &mut MeasureCx) -> Size
测量组件在给定约束下的自适应尺寸 Read more
Source§fn layout(&mut self, rect: Rect, _cx: &mut LayoutCx<'_>)
fn layout(&mut self, rect: Rect, _cx: &mut LayoutCx<'_>)
布局回调——组件在此计算子节点 rect 并调用 child.layout() Read more
Source§fn for_each_child(&self, _f: &mut dyn FnMut(&Node))
fn for_each_child(&self, _f: &mut dyn FnMut(&Node))
遍历子节点(为焦点系统等提供统一的树遍历接口)
Source§fn for_each_child_mut(&mut self, _f: &mut dyn FnMut(&mut Node))
fn for_each_child_mut(&mut self, _f: &mut dyn FnMut(&mut Node))
遍历子节点(可变版本)
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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