pub trait TableDelegate {
// Required methods
fn header_cell_ui(&mut self, ui: &mut Ui, cell: &HeaderCellInfo);
fn cell_ui(&mut self, ui: &mut Ui, cell: &CellInfo);
// Provided methods
fn prepare(&mut self, _info: &PrefetchInfo) { ... }
fn row_ui(&mut self, _ui: &mut Ui, _row_nr: u64) { ... }
fn row_top_offset(&self, _ctx: &Context, _table_id: Id, row_nr: u64) -> f32 { ... }
fn default_row_height(&self) -> f32 { ... }
}Expand description
The interface that the user needs to implement to display a table.
The Table calls functions on the delegate to render the table.
Required Methods§
Sourcefn header_cell_ui(&mut self, ui: &mut Ui, cell: &HeaderCellInfo)
fn header_cell_ui(&mut self, ui: &mut Ui, cell: &HeaderCellInfo)
The contents of a header cell in the table.
The CellInfo::row_nr is which header row (usually 0).
Sourcefn cell_ui(&mut self, ui: &mut Ui, cell: &CellInfo)
fn cell_ui(&mut self, ui: &mut Ui, cell: &CellInfo)
The contents of a cell in the table.
The CellInfo::row_nr is ignoring header rows.
Provided Methods§
Sourcefn prepare(&mut self, _info: &PrefetchInfo)
fn prepare(&mut self, _info: &PrefetchInfo)
Called before any call to Self::cell_ui to communicate the range of visible columns and rows.
You can use this to only load the data required to be viewed.
Sourcefn row_ui(&mut self, _ui: &mut Ui, _row_nr: u64)
fn row_ui(&mut self, _ui: &mut Ui, _row_nr: u64)
The contents of a row.
Individual cell Uis will be children of the ui passed to this fn, so you can e.g. use
Ui::style_mut to style the whole row.
This might be called multiple times per row (e.g. for sticky and non-sticky columns).
Sourcefn row_top_offset(&self, _ctx: &Context, _table_id: Id, row_nr: u64) -> f32
fn row_top_offset(&self, _ctx: &Context, _table_id: Id, row_nr: u64) -> f32
Compute the offset for the top of the given row.
Implement this for arbitrary row heights. The default implementation uses
Self::default_row_height.
Note: must always return 0.0 for row_nr = 0.
Sourcefn default_row_height(&self) -> f32
fn default_row_height(&self) -> f32
Default row height.
This is used by the default implementation of Self::row_top_offset.