Trait egui_data_table::viewer::RowViewer

source ·
pub trait RowViewer<R>: 'static {
Show 22 methods // Required methods fn num_columns(&mut self) -> usize; fn show_cell_view(&mut self, ui: &mut Ui, row: &R, column: usize); fn show_cell_editor( &mut self, ui: &mut Ui, row: &mut R, column: usize ) -> Option<Response>; fn set_cell_value(&mut self, src: &R, dst: &mut R, column: usize); fn new_empty_row(&mut self) -> R; // Provided methods fn column_name(&mut self, column: usize) -> Cow<'static, str> { ... } fn column_render_config(&mut self, column: usize) -> TableColumnConfig { ... } fn is_sortable_column(&mut self, column: usize) -> bool { ... } fn create_cell_comparator(&mut self) -> impl Fn(&R, &R, usize) -> Ordering { ... } fn row_filter_hash(&mut self) -> &impl Hash { ... } fn create_row_filter(&mut self) -> impl Fn(&R) -> bool { ... } fn on_cell_view_response( &mut self, row: &R, column: usize, resp: &Response ) -> Option<Box<R>> { ... } fn confirm_cell_write_by_ui( &mut self, current: &R, next: &R, column: usize, context: CellWriteContext ) -> bool { ... } fn confirm_row_deletion_by_ui(&mut self, row: &R) -> bool { ... } fn new_empty_row_for(&mut self, context: EmptyRowCreateContext) -> R { ... } fn clone_row(&mut self, row: &R) -> R { ... } fn clone_row_for_insertion(&mut self, row: &R) -> R { ... } fn clone_row_as_copied_base(&mut self, row: &R) -> R { ... } fn on_highlight_cell(&mut self, row: &R, column: usize) { ... } fn hotkeys( &mut self, context: &UiActionContext ) -> Vec<(KeyboardShortcut, UiAction)> { ... } fn trivial_config(&mut self) -> TrivialConfig { ... } fn persist_ui_state(&self) -> bool { ... }
}
Expand description

The primary trait for the spreadsheet viewer.

Required Methods§

source

fn num_columns(&mut self) -> usize

Number of columns. Changing this will invalidate the table rendering status totally(including undo histories), therefore frequently changing this value is discouraged.

source

fn show_cell_view(&mut self, ui: &mut Ui, row: &R, column: usize)

Display values of the cell. Any input will be consumed before table renderer; therefore any widget rendered inside here is read-only.

To deal with input, use cell_edit method. If you need to deal with drag/drop, see RowViewer::on_cell_view_response which delivers resulting response of containing cell.

source

fn show_cell_editor( &mut self, ui: &mut Ui, row: &mut R, column: usize ) -> Option<Response>

Edit values of the cell.

source

fn set_cell_value(&mut self, src: &R, dst: &mut R, column: usize)

Set the value of a column in a row.

source

fn new_empty_row(&mut self) -> R

Create a new empty row.

Provided Methods§

source

fn column_name(&mut self, column: usize) -> Cow<'static, str>

Name of the column. This can be dynamically changed.

source

fn column_render_config(&mut self, column: usize) -> TableColumnConfig

Returns the rendering configuration for the column.

source

fn is_sortable_column(&mut self, column: usize) -> bool

Returns if given column is ‘sortable’

source

fn create_cell_comparator(&mut self) -> impl Fn(&R, &R, usize) -> Ordering

Compare two column contents for sort.

source

fn row_filter_hash(&mut self) -> &impl Hash

Get hash value of a filter. This is used to determine if the filter has changed.

source

fn create_row_filter(&mut self) -> impl Fn(&R) -> bool

Create a filter for the row. Filter is applied on every table invalidation.

source

fn on_cell_view_response( &mut self, row: &R, column: usize, resp: &Response ) -> Option<Box<R>>

Use this to check if given cell is going to take any dropped payload / use as drag source.

source

fn confirm_cell_write_by_ui( &mut self, current: &R, next: &R, column: usize, context: CellWriteContext ) -> bool

In the write context that happens outside of show_cell_editor, this method is called on every cell value editions.

source

fn confirm_row_deletion_by_ui(&mut self, row: &R) -> bool

Before removing each row, this method is called to confirm the deletion from the viewer. This won’t be called during the undo/redo operation!

source

fn new_empty_row_for(&mut self, context: EmptyRowCreateContext) -> R

Create a new empty row under the given context.

source

fn clone_row(&mut self, row: &R) -> R

Create duplication of existing row.

You may want to override this method for more efficient duplication.

source

fn clone_row_for_insertion(&mut self, row: &R) -> R

Create duplication of existing row for insertion.

source

fn clone_row_as_copied_base(&mut self, row: &R) -> R

Create duplication of existing row for clipboard. Useful when you need to specify different behavior for clipboard duplication. (e.g. unset transient flag)

source

fn on_highlight_cell(&mut self, row: &R, column: usize)

Called when a cell is selected/highlighted.

source

fn hotkeys( &mut self, context: &UiActionContext ) -> Vec<(KeyboardShortcut, UiAction)>

Return hotkeys for the current context.

source

fn trivial_config(&mut self) -> TrivialConfig

Get trivial configurations for renderer.

source

fn persist_ui_state(&self) -> bool

If you want to keep UI state on storage(i.e. persist over sessions), return true from this function.

Object Safety§

This trait is not object safe.

Implementors§