pub struct TableView<T, A = ()> { /* private fields */ }Expand description
Scrollable table with typed row activation and controlled visual selection.
T is cloned when a row is activated; A is the application action returned
by non-context callbacks. Self::bind_selected installs writable selection,
while Self::selected is read-only. Activating an enabled row writes and/or
invokes configured handlers even when its ID already equals the selection.
Overflowing body axes paint overlay scrollbars above the clipped rows while
the header remains fixed. Thumb dragging and centered track clicks do not
activate rows; a disabled table accepts neither interaction.
§Examples
use ailloli_ui_widgets::controls::{TableCell, TableColumn, TableRow, TableView};
let table: TableView<i32> = TableView::new()
.column(TableColumn::new("Value"))
.row(TableRow::new(1).cell(TableCell::text("One")));
let _ = table;Implementations§
Source§impl<T: Clone + PartialEq + 'static, A: 'static> TableView<T, A>
impl<T: Clone + PartialEq + 'static, A: 'static> TableView<T, A>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an enabled empty table with zebra stripes enabled.
It has no columns, rows, selection, handler, or body-height cap.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new();
let _ = table;Sourcepub fn column(self, column: TableColumn) -> Self
pub fn column(self, column: TableColumn) -> Self
Appends a column in display order.
§Examples
use ailloli_ui_widgets::controls::{TableColumn, TableView};
let table: TableView<i32> = TableView::new().column(TableColumn::new("Name"));
let _ = table;Sourcepub fn row(self, row: TableRow<T>) -> Self
pub fn row(self, row: TableRow<T>) -> Self
Appends one row in display order.
§Examples
use ailloli_ui_widgets::controls::{TableRow, TableView};
let table: TableView<i32> = TableView::new().row(TableRow::new(1));
let _ = table;Sourcepub fn rows(self, rows: impl IntoIterator<Item = TableRow<T>>) -> Self
pub fn rows(self, rows: impl IntoIterator<Item = TableRow<T>>) -> Self
Extends rows in iterator order without clearing existing rows.
§Examples
use ailloli_ui_widgets::controls::{TableRow, TableView};
let table: TableView<i32> = TableView::new().rows([TableRow::new(1), TableRow::new(2)]);
let _ = table;Sourcepub fn selected(self, selected: impl Into<Binding<T>>) -> Self
pub fn selected(self, selected: impl Into<Binding<T>>) -> Self
Sets a read-only static or reactive selection and clears writable binding.
Every row with an equal ID paints selected. Row activation can still invoke
on_select, but cannot mutate this binding.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().selected(1);
let _ = table;Sourcepub fn bind_selected(self, selected: impl Into<Signal<T>>) -> Self
pub fn bind_selected(self, selected: impl Into<Signal<T>>) -> Self
Binds a writable table-level selection signal.
Activating an enabled row writes its ID even if equal to the current value, before invoking the optional callback.
§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().bind_selected(State::new(1));
let _ = table;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Sets static or reactive whole-table disabled state.
Disabled tables are not focusable and ignore input; all rows paint with disabled text/icon/progress treatment.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().disabled(true);
let _ = table;Sourcepub fn disabled_signal(self, disabled: Memo<bool>) -> Self
pub fn disabled_signal(self, disabled: Memo<bool>) -> Self
Uses a memo as the reactive whole-table disabled binding.
§Examples
use ailloli_ui_runtime::component::Memo;
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().disabled_signal(Memo::new(|| false));
let _ = table;Sourcepub fn on_select(self, f: impl Fn(T) -> A + 'static) -> Self
pub fn on_select(self, f: impl Fn(T) -> A + 'static) -> Self
Dispatches the application action returned for an activated enabled row.
The handler runs even when the row ID already equals controlled selection. Disabled or out-of-range rows emit nothing.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32, i32> = TableView::new().on_select(|id| id);
let _ = table;Sourcepub fn on_select_ctx(self, f: impl Fn(&mut EventCtx<A>, T) + 'static) -> Self
pub fn on_select_ctx(self, f: impl Fn(&mut EventCtx<A>, T) + 'static) -> Self
Handles an activated enabled row with direct event-context access.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().on_select_ctx(|_ctx, _id| {});
let _ = table;Sourcepub fn table_style(self, style: TableViewStyle) -> Self
pub fn table_style(self, style: TableViewStyle) -> Self
Replaces table style without altering explicit layout values.
§Examples
use ailloli_ui_widgets::controls::{TableView, TableViewStyle};
let table: TableView<i32> = TableView::new().table_style(TableViewStyle::default());
let _ = table;Sourcepub fn table_size(self, size: TableViewSize) -> Self
pub fn table_size(self, size: TableViewSize) -> Self
Re-derives style from the default theme and requested density.
This overwrites every prior table-style customization.
§Examples
use ailloli_ui_widgets::controls::{TableView, TableViewSize};
let table: TableView<i32> = TableView::new().table_size(TableViewSize::Compact);
let _ = table;Sourcepub fn max_body_height(self, height: f32) -> Self
pub fn max_body_height(self, height: f32) -> Self
Sets an optional maximum intrinsic body height in logical pixels.
Finite negatives become 0.0; finite nonnegative values are retained;
NaN and either infinity clear the cap. Explicit layout height can still
override intrinsic sizing.
§Examples
use ailloli_ui_widgets::controls::TableView;
let capped: TableView<i32> = TableView::new().max_body_height(144.0);
let uncapped: TableView<i32> = TableView::new().max_body_height(f32::NAN);
let _ = (capped, uncapped);Sourcepub fn zebra(self, enabled: bool) -> Self
pub fn zebra(self, enabled: bool) -> Self
Enables or disables alternate background on odd unselected/inactive rows.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().zebra(false);
let _ = table;Sourcepub fn width(self, value: impl Into<Length>) -> Self
pub fn width(self, value: impl Into<Length>) -> Self
Replaces the preferred table width.
Numeric inputs are logical pixels; [Length::Auto] preserves intrinsic
sizing and [Length::Fill] requests the parent-provided width.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().width(420.0);
let _ = table;Sourcepub fn height(self, value: impl Into<Length>) -> Self
pub fn height(self, value: impl Into<Length>) -> Self
Replaces the preferred table height.
Numeric inputs are logical pixels. An explicit height controls the whole table, including its fixed header, and can override intrinsic body sizing.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().height(280.0);
let _ = table;Sourcepub fn min_width(self, value: impl Into<Length>) -> Self
pub fn min_width(self, value: impl Into<Length>) -> Self
Replaces the minimum-width declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().min_width(240.0);
let _ = table;Sourcepub fn max_width(self, value: impl Into<Length>) -> Self
pub fn max_width(self, value: impl Into<Length>) -> Self
Replaces the maximum-width declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().max_width(960.0);
let _ = table;Sourcepub fn min_height(self, value: impl Into<Length>) -> Self
pub fn min_height(self, value: impl Into<Length>) -> Self
Replaces the minimum-height declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().min_height(120.0);
let _ = table;Sourcepub fn max_height(self, value: impl Into<Length>) -> Self
pub fn max_height(self, value: impl Into<Length>) -> Self
Replaces the maximum-height declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().max_height(640.0);
let _ = table;Sourcepub fn fill(self) -> Self
pub fn fill(self) -> Self
Requests parent-fill sizing on both axes.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().fill();
let _ = table;Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Requests parent-fill width while preserving the height declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().height(240.0).fill_width();
let _ = table;Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Requests parent-fill height while preserving the width declaration.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().width(360.0).fill_height();
let _ = table;Sourcepub fn margin(self, value: f32) -> Self
pub fn margin(self, value: f32) -> Self
Replaces every outer margin edge with value logical pixels.
The value is stored verbatim, including negative and non-finite input.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().margin(8.0);
let _ = table;Sourcepub fn padding(self, value: f32) -> Self
pub fn padding(self, value: f32) -> Self
Replaces every inner padding edge with value logical pixels.
The value is stored verbatim, including negative and non-finite input.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().padding(12.0);
let _ = table;Sourcepub fn flex_grow(self) -> Self
pub fn flex_grow(self) -> Self
Sets this table’s flex-grow weight to one.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().flex_grow();
let _ = table;Sourcepub fn flex_grow_by(self, value: f32) -> Self
pub fn flex_grow_by(self, value: f32) -> Self
Sets the dimensionless flex-grow weight, clamped to at least zero.
NaN and negative infinity become zero; positive infinity is retained.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().flex_grow_by(2.0);
let _ = table;Sourcepub fn flex_shrink(self, value: f32) -> Self
pub fn flex_shrink(self, value: f32) -> Self
Sets the dimensionless flex-shrink weight, clamped to at least zero.
NaN and negative infinity become zero; positive infinity is retained.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().flex_shrink(1.0);
let _ = table;Sourcepub fn flex_basis(self, value: impl Into<Length>) -> Self
pub fn flex_basis(self, value: impl Into<Length>) -> Self
Replaces the preferred main-axis size used by a flex parent.
Numeric inputs are logical pixels.
§Examples
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().flex_basis(320.0);
let _ = table;Sourcepub fn align_self(self, value: AlignItems) -> Self
pub fn align_self(self, value: AlignItems) -> Self
Overrides the flex parent’s cross-axis alignment for this table.
§Examples
use ailloli_ui_core::style::AlignItems;
use ailloli_ui_widgets::controls::TableView;
let table: TableView<i32> = TableView::new().align_self(AlignItems::Center);
let _ = table;