pub struct TableEdit<'a, T, E>where
E: TableEditor<T> + 'a,{ /* private fields */ }Expand description
Table-widget and inline editor for one table-row.
This widget keeps a Vec<RowData> and modifies it.
It’s parameterized with an Editor widget, that renders
the input-widgets.
See examples/table2_edit.
Implementations§
Source§impl<'a, T, E> TableEdit<'a, T, E>where
E: TableEditor<T> + 'a,
impl<'a, T, E> TableEdit<'a, T, E>where
E: TableEditor<T> + 'a,
pub fn new(editor: E) -> TableEdit<'a, T, E>
Set the table-footer.
Sourcepub fn widths<I>(self, widths: I) -> TableEdit<'a, T, E>
pub fn widths<I>(self, widths: I) -> TableEdit<'a, T, E>
Column widths as Constraints.
The constraints work in tandem with Table::layout_width.
Sourcepub fn varying_heights(self, varying: bool) -> TableEdit<'a, T, E>
pub fn varying_heights(self, varying: bool) -> TableEdit<'a, T, E>
If your table uses varying row-heights for each row all page calculations will fail (somewhat). If you enable this flag, the row-heights for each row will be stored in the state to allow accurate page-calculations.
Sourcepub fn column_spacing(self, spacing: u16) -> TableEdit<'a, T, E>
pub fn column_spacing(self, spacing: u16) -> TableEdit<'a, T, E>
Spacing between columns.
Sourcepub fn layout_width(self, width: LayoutWidth) -> TableEdit<'a, T, E>
pub fn layout_width(self, width: LayoutWidth) -> TableEdit<'a, T, E>
Set the display width of the table.
Default The width of the rendered area is used.
Sourcepub fn block(self, block: Block<'a>) -> TableEdit<'a, T, E>
pub fn block(self, block: Block<'a>) -> TableEdit<'a, T, E>
Draws a block around the table widget.
Sourcepub fn border_style(self, style: Style) -> TableEdit<'a, T, E>
pub fn border_style(self, style: Style) -> TableEdit<'a, T, E>
Sets the border-style for the Block, if any.
Sourcepub fn title_style(self, style: Style) -> TableEdit<'a, T, E>
pub fn title_style(self, style: Style) -> TableEdit<'a, T, E>
Sets the title-style for the Block, if any.
Sourcepub fn styles(self, styles: TableStyle) -> TableEdit<'a, T, E>
pub fn styles(self, styles: TableStyle) -> TableEdit<'a, T, E>
Set all styles as a bundle.
Sourcepub fn header_style(self, style: Option<Style>) -> TableEdit<'a, T, E>
pub fn header_style(self, style: Option<Style>) -> TableEdit<'a, T, E>
Base style for the table.
Base style for the table.
Sourcepub fn select_row_style(
self,
select_style: Option<Style>,
) -> TableEdit<'a, T, E>
pub fn select_row_style( self, select_style: Option<Style>, ) -> TableEdit<'a, T, E>
Style for a selected row. The chosen selection must support row-selection for this to take effect.
Sourcepub fn show_row_focus(self, show: bool) -> TableEdit<'a, T, E>
pub fn show_row_focus(self, show: bool) -> TableEdit<'a, T, E>
Add the focus-style to the row-style if the table is focused.
Sourcepub fn select_column_style(
self,
select_style: Option<Style>,
) -> TableEdit<'a, T, E>
pub fn select_column_style( self, select_style: Option<Style>, ) -> TableEdit<'a, T, E>
Style for a selected column. The chosen selection must support column-selection for this to take effect.
Sourcepub fn show_column_focus(self, show: bool) -> TableEdit<'a, T, E>
pub fn show_column_focus(self, show: bool) -> TableEdit<'a, T, E>
Add the focus-style to the column-style if the table is focused.
Sourcepub fn select_cell_style(
self,
select_style: Option<Style>,
) -> TableEdit<'a, T, E>
pub fn select_cell_style( self, select_style: Option<Style>, ) -> TableEdit<'a, T, E>
Style for a selected cell. The chosen selection must support cell-selection for this to take effect.
Sourcepub fn show_cell_focus(self, show: bool) -> TableEdit<'a, T, E>
pub fn show_cell_focus(self, show: bool) -> TableEdit<'a, T, E>
Add the focus-style to the cell-style if the table is focused.
Sourcepub fn select_header_style(
self,
select_style: Option<Style>,
) -> TableEdit<'a, T, E>
pub fn select_header_style( self, select_style: Option<Style>, ) -> TableEdit<'a, T, E>
Style for a selected header cell. The chosen selection must support column-selection for this to take effect.
Sourcepub fn show_header_focus(self, show: bool) -> TableEdit<'a, T, E>
pub fn show_header_focus(self, show: bool) -> TableEdit<'a, T, E>
Add the focus-style to the header-style if the table is focused.
Style for a selected footer cell. The chosen selection must support column-selection for this to take effect.
Add the footer-style to the table-style if the table is focused.
Sourcepub fn focus_style(self, focus_style: Option<Style>) -> TableEdit<'a, T, E>
pub fn focus_style(self, focus_style: Option<Style>) -> TableEdit<'a, T, E>
This style will be patched onto the selection to indicate that the widget has the input focus.
The selection must support some kind of selection for this to be effective.
Sourcepub fn row_height(
self,
row_height_fn: fn(&T, &TableContext<'_>) -> u8,
) -> TableEdit<'a, T, E>
pub fn row_height( self, row_height_fn: fn(&T, &TableContext<'_>) -> u8, ) -> TableEdit<'a, T, E>
A closure that calculates the row-height for a given row-value.
Sourcepub fn render_row(
self,
render_row_fn: impl FnMut(&T, Rect, &mut Buffer, &TableContext<'_>) -> bool + 'a,
) -> TableEdit<'a, T, E>
pub fn render_row( self, render_row_fn: impl FnMut(&T, Rect, &mut Buffer, &TableContext<'_>) -> bool + 'a, ) -> TableEdit<'a, T, E>
A closure for row-level rendering. The area covers the full row.
Return
Returns true if the individual cells should be rendered too.
Sourcepub fn render_cell(
self,
column: usize,
render_cell_fn: impl FnMut(&T, Rect, &mut Buffer, &TableContext<'_>) + 'a,
) -> TableEdit<'a, T, E>
pub fn render_cell( self, column: usize, render_cell_fn: impl FnMut(&T, Rect, &mut Buffer, &TableContext<'_>) + 'a, ) -> TableEdit<'a, T, E>
A closure for rendering a single column.
The area covers the exact column. Extra information is available in the TableContext.
The given Buffer covers the full row so you could render something outside the cells bounds. Cells for a given row are always rendered in ascending order.
Source§impl<'a, 'b, T, E> TableEdit<'a, T, E>where
'b: 'a,
E: TableEditor<T> + 'a,
impl<'a, 'b, T, E> TableEdit<'a, T, E>where
'b: 'a,
E: TableEditor<T> + 'a,
pub fn render( self, area: Rect, buf: &mut Buffer, state: &'b mut TableEditState<T, <E as TableEditor<T>>::State>, )
Auto Trait Implementations§
impl<'a, T, E> !RefUnwindSafe for TableEdit<'a, T, E>
impl<'a, T, E> !Send for TableEdit<'a, T, E>
impl<'a, T, E> !Sync for TableEdit<'a, T, E>
impl<'a, T, E> !UnwindSafe for TableEdit<'a, T, E>
impl<'a, T, E> Forget for TableEdit<'a, T, E>
impl<'a, T, E> Freeze for TableEdit<'a, T, E>
impl<'a, T, E> Unpin for TableEdit<'a, T, E>
impl<'a, T, E> UnsafeUnpin for TableEdit<'a, T, E>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more