pub trait TableDataIter<'a> {
// Required methods
fn rows(&self) -> Option<usize>;
fn nth(&mut self, n: usize) -> bool;
fn render_cell(
&self,
ctx: &TableContext,
column: usize,
area: Rect,
buf: &mut Buffer,
);
// Provided methods
fn cloned(&self) -> Option<Box<dyn TableDataIter<'a> + 'a>> { ... }
fn header(&self) -> Option<Row<'a>> { ... }
fn footer(&self) -> Option<Row<'a>> { ... }
fn row_height(&self) -> u16 { ... }
fn row_style(&self) -> Option<Style> { ... }
fn widths(&self) -> Vec<Constraint> { ... }
}Expand description
Trait for accessing the table-data by the Table.
This trait is suitable if the underlying data is an iterator.
Required Methods§
Sourcefn rows(&self) -> Option<usize>
fn rows(&self) -> Option<usize>
Returns the number of rows, if known.
If they are not known, all items will be iterated to calculate things as the length of the table. Which will be slower if you have many items.
Sourcefn nth(&mut self, n: usize) -> bool
fn nth(&mut self, n: usize) -> bool
Skips to the nth item, returns true if such an item exists. nth(0) == next()
Sourcefn render_cell(
&self,
ctx: &TableContext,
column: usize,
area: Rect,
buf: &mut Buffer,
)
fn render_cell( &self, ctx: &TableContext, column: usize, area: Rect, buf: &mut Buffer, )
Render the cell for the current line.
- ctx - a lot of context data.
Provided Methods§
Sourcefn cloned(&self) -> Option<Box<dyn TableDataIter<'a> + 'a>>
fn cloned(&self) -> Option<Box<dyn TableDataIter<'a> + 'a>>
StatefulWidgetRef needs a clone of the iterator for every render. For StatefulWidget this is not needed at all. So this defaults to None and warns at runtime.
Sourcefn header(&self) -> Option<Row<'a>>
fn header(&self) -> Option<Row<'a>>
Header can be obtained from here. Alternative to setting on Table.
Footer can be obtained from here. Alternative to setting on Table.
Sourcefn row_height(&self) -> u16
fn row_height(&self) -> u16
Row height for the current item.
Sourcefn widths(&self) -> Vec<Constraint>
fn widths(&self) -> Vec<Constraint>
Column constraints.