pub trait TableDelegate: Sized + 'static {
Show 18 methods
// Required methods
fn columns_count(&self, cx: &App) -> usize;
fn rows_count(&self, cx: &App) -> usize;
fn column(&self, col_ix: usize, cx: &App) -> &Column;
fn render_td(
&self,
row_ix: usize,
col_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement;
// Provided methods
fn perform_sort(
&mut self,
col_ix: usize,
sort: ColumnSort,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) { ... }
fn render_th(
&self,
col_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement { ... }
fn render_tr(
&self,
row_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> Stateful<Div> { ... }
fn context_menu(
&self,
row_ix: usize,
menu: PopupMenu,
window: &Window,
cx: &App,
) -> PopupMenu { ... }
fn move_column(
&mut self,
col_ix: usize,
to_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) { ... }
fn render_empty(
&self,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement { ... }
fn loading(&self, cx: &App) -> bool { ... }
fn render_loading(
&self,
size: Size,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement { ... }
fn is_eof(&self, cx: &App) -> bool { ... }
fn load_more_threshold(&self) -> usize { ... }
fn load_more(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) { ... }
fn render_last_empty_col(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement { ... }
fn visible_rows_changed(
&mut self,
visible_range: Range<usize>,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) { ... }
fn visible_columns_changed(
&mut self,
visible_range: Range<usize>,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) { ... }
}
Required Methods§
Sourcefn columns_count(&self, cx: &App) -> usize
fn columns_count(&self, cx: &App) -> usize
Return the number of columns in the table.
Sourcefn rows_count(&self, cx: &App) -> usize
fn rows_count(&self, cx: &App) -> usize
Return the number of rows in the table.
Provided Methods§
Sourcefn perform_sort(
&mut self,
col_ix: usize,
sort: ColumnSort,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
)
fn perform_sort( &mut self, col_ix: usize, sort: ColumnSort, window: &mut Window, cx: &mut Context<'_, Table<Self>>, )
Perform sort on the column at the given index.
Sourcefn render_th(
&self,
col_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement
fn render_th( &self, col_ix: usize, window: &mut Window, cx: &mut Context<'_, Table<Self>>, ) -> impl IntoElement
Render the header cell at the given column index, default to the column name.
Sourcefn render_tr(
&self,
row_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> Stateful<Div>
fn render_tr( &self, row_ix: usize, window: &mut Window, cx: &mut Context<'_, Table<Self>>, ) -> Stateful<Div>
Render the row at the given row and column.
Render the context menu for the row at the given row index.
Sourcefn move_column(
&mut self,
col_ix: usize,
to_ix: usize,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
)
fn move_column( &mut self, col_ix: usize, to_ix: usize, window: &mut Window, cx: &mut Context<'_, Table<Self>>, )
Move the column at the given col_ix
to insert before the column at the given to_ix
.
Sourcefn render_empty(
&self,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement
fn render_empty( &self, window: &mut Window, cx: &mut Context<'_, Table<Self>>, ) -> impl IntoElement
Return a Element to show when table is empty.
Sourcefn render_loading(
&self,
size: Size,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement
fn render_loading( &self, size: Size, window: &mut Window, cx: &mut Context<'_, Table<Self>>, ) -> impl IntoElement
Return a Element to show when table is loading, default is built-in Skeleton loading view.
The size is the size of the Table.
Sourcefn is_eof(&self, cx: &App) -> bool
fn is_eof(&self, cx: &App) -> bool
Return true to enable load more data when scrolling to the bottom.
Default: true
Sourcefn load_more_threshold(&self) -> usize
fn load_more_threshold(&self) -> usize
Returns a threshold value (n rows), of course, when scrolling to the bottom,
the remaining number of rows triggers load_more
.
This should smaller than the total number of first load rows.
Default: 20 rows
Sourcefn load_more(&mut self, window: &mut Window, cx: &mut Context<'_, Table<Self>>)
fn load_more(&mut self, window: &mut Window, cx: &mut Context<'_, Table<Self>>)
Load more data when the table is scrolled to the bottom.
This will performed in a background task.
This is always called when the table is near the bottom, so you must check if there is more data to load or lock the loading state.
Sourcefn render_last_empty_col(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
) -> impl IntoElement
fn render_last_empty_col( &mut self, window: &mut Window, cx: &mut Context<'_, Table<Self>>, ) -> impl IntoElement
Render the last empty column, default to empty.
Sourcefn visible_rows_changed(
&mut self,
visible_range: Range<usize>,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
)
fn visible_rows_changed( &mut self, visible_range: Range<usize>, window: &mut Window, cx: &mut Context<'_, Table<Self>>, )
Called when the visible range of the rows changed.
NOTE: Make sure this method is fast, because it will be called frequently.
This can used to handle some data update, to only update the visible rows. Please ensure that the data is updated in the background task.
Sourcefn visible_columns_changed(
&mut self,
visible_range: Range<usize>,
window: &mut Window,
cx: &mut Context<'_, Table<Self>>,
)
fn visible_columns_changed( &mut self, visible_range: Range<usize>, window: &mut Window, cx: &mut Context<'_, Table<Self>>, )
Called when the visible range of the columns changed.
NOTE: Make sure this method is fast, because it will be called frequently.
This can used to handle some data update, to only update the visible rows. Please ensure that the data is updated in the background task.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.