pub trait TableData<'a> {
// Required methods
fn rows(&self) -> usize;
fn render_cell(
&self,
ctx: &TableContext,
column: usize,
row: usize,
area: Rect,
buf: &mut Buffer,
);
// Provided methods
fn header(&self) -> Option<Row<'a>> { ... }
fn footer(&self) -> Option<Row<'a>> { ... }
fn row_height(&self, row: usize) -> u16 { ... }
fn row_style(&self, row: usize) -> 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 some sort of vec/slice.
Required Methods§
Sourcefn render_cell(
&self,
ctx: &TableContext,
column: usize,
row: usize,
area: Rect,
buf: &mut Buffer,
)
fn render_cell( &self, ctx: &TableContext, column: usize, row: usize, area: Rect, buf: &mut Buffer, )
Render the cell given by column/row.
- ctx - a lot of context data.
Provided Methods§
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, row: usize) -> u16
fn row_height(&self, row: usize) -> u16
Row height.
Sourcefn widths(&self) -> Vec<Constraint>
fn widths(&self) -> Vec<Constraint>
Column constraints.
Trait Implementations§
Source§impl<'a> TableData<'a> for Box<dyn TableData<'a> + 'a>
impl<'a> TableData<'a> for Box<dyn TableData<'a> + 'a>
Source§fn 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.
Source§fn row_height(&self, row: usize) -> u16
fn row_height(&self, row: usize) -> u16
Row height.
Source§fn widths(&self) -> Vec<Constraint>
fn widths(&self) -> Vec<Constraint>
Column constraints.
Source§fn render_cell(
&self,
ctx: &TableContext,
column: usize,
row: usize,
area: Rect,
buf: &mut Buffer,
)
fn render_cell( &self, ctx: &TableContext, column: usize, row: usize, area: Rect, buf: &mut Buffer, )
Render the cell given by column/row. Read more