pub struct DataTable { /* private fields */ }Expand description
A data grid: typed columns + text row data, rendered via Table with
a sortable header and optional selection checkboxes.
Implementations§
Source§impl DataTable
impl DataTable
pub fn new(columns: Vec<DataTableColumn>) -> Self
Sourcepub fn row(self, cells: Vec<impl Into<String>>) -> Self
pub fn row(self, cells: Vec<impl Into<String>>) -> Self
Append one row of cell text (one string per column, left to right).
Sourcepub fn row_builder<S: Into<String>>(
self,
count: usize,
builder: impl Fn(usize) -> Vec<S>,
) -> Self
pub fn row_builder<S: Into<String>>( self, count: usize, builder: impl Fn(usize) -> Vec<S>, ) -> Self
count rows, each built by calling builder(i) for its cell text
(one string per column, left to right) — the same convenience
constructor Table::row_builder/Grid::builder have.
Sourcepub fn sorted_by(self, col: usize, dir: SortDirection) -> Self
pub fn sorted_by(self, col: usize, dir: SortDirection) -> Self
Which column currently shows a sort indicator, and its direction —
visual only; the app is responsible for actually sorting rows.
pub fn row_striping(self, c: Color) -> Self
Sourcepub fn selectable(self, selected: Vec<bool>) -> Self
pub fn selectable(self, selected: Vec<bool>) -> Self
Shows a leading checkbox column. selected must be as long as rows.
pub fn on_sort( self, f: impl Fn(usize, SortDirection) + Send + Sync + 'static, ) -> Self
pub fn on_select(self, f: impl Fn(usize, bool) + Send + Sync + 'static) -> Self
Trait Implementations§
Source§impl Widget for DataTable
impl Widget for DataTable
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl !RefUnwindSafe for DataTable
impl !UnwindSafe for DataTable
impl Freeze for DataTable
impl Send for DataTable
impl Sync for DataTable
impl Unpin for DataTable
impl UnsafeUnpin for DataTable
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<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.