Fast and responsive table viewer and editor, that only shows visible rows. The data model is fully generic, allowing implementations based on vectors, files, databases, live bus traces and other data structures.
TODO: Add web demo.
- Data comes from the egui-free TableModel trait; change detection with revision counters, so any number of views and app code can observe one model.
- Custom cell viewer and editor ui through CellUi, any egui or user widgets can be used.
A row is looked up once and its cells filled by column, values (
Variant) are optional. - Built-in cell viewers and editors (VariantCellUi) and an in-memory VariantTable:
- String, string list, numbers, booleans, custom enums
- Date, time, date-time
- SI values, currency
- Data import with automatic column mapping based on names.
- CSV support.
- XLS support.
- Manual column mapping to one of the choices provided by the backend (combo box above columns).
- Undo / Redo support.
- Cell values don't have to be in memory (if the model supports it); the view keeps one id per row.
- Sorting by several columns: click the sort arrows in a header, Shift+click adds a key (
TableViewConfig::sort). - Filtering: quick filter over all columns and per-column filters (
TableViewConfig::filter), hide columns and a column chooser; sort, filter and hidden columns are saved with the view config. - Date, time and date-time cells (
FormattedCellUi). - Keyboard shortcuts and navigation.
- Copy-paste support for cells and blocks of cells.
- Ability to add lints to cells and change their background color.
- Add icons
- Support for cells with varying heights.
- Read-only cells spanning several rows, reported by the model (
TableModel::row_span), e.g. bookings in a schedule. - Resizable, auto-sized columns.
- Scroll position anchored to a row: stays put when rows are inserted above.
- Drag&drop column reordering.
- Pinned (frozen) left columns, including the tool column, stay while the rest scrolls sideways (
TableViewConfig::pinned_columns). - Export to CSV.
- Stick to bottom mode for viewing real time data.
- Visual state can be persisted on disk.
- Disable/enable rows and columns (disabled cells are crossed out).
- Change a column type and try to turn data into requested type (VariantTable, only from code now).
- Values are converted to the column type on paste and import; ones that don't convert are highlighted.
- Derive macro to show Vec as table.
- Improve drag&drop, like on DK
use egui_tabular::rvariant::VariantTy;
use egui_tabular::{ColumnDef, TableView, TableViewConfig, TableViewOptions, VariantCellUi, VariantTable};
let mut table = VariantTable::new([ColumnDef::new("Name", VariantTy::Str)]);
let mut view = TableView::new(TableViewOptions::default());
let mut config = TableViewConfig::default(); // user preferences, serde
// Every frame:
let output = view.show(ui, &mut table, &mut VariantCellUi, &mut config);
for event in output.events { /* selection, committed edits, messages for the user, ... */ }For your own data, implement TableModel (data only) and, for custom rendering, CellUi.
See demos/ and #[derive(TabularRow)].
- Become Excel or G.Sheets replacement (no merging or editing of merged cells; read-only row spans from the model are supported).
- Export to XLS / XLSX
- Ctrl+V - paste block
- Ctrl+C (Cmd+C) - copy block, or the highlighted text with
TableViewOptions::selectable_text - Ctrl+A - select all (when not editing)
- Tab - commit edit and edit cell to the right
- E - edit cell
- Esc - cancel edit or unselect
- Left, Right, Up, Down - move selection (scrolls it into view)
- +Shift - expand selection
- N - append new row and scroll to it
- Shift + click - expand selection
- Click sort arrows in a column header - sort ascending, descending, off
- Shift + click sort arrows - add the column as the next sort key
- Drag column edge - resize, double-click it - back to auto width
Experimental — many of the essential features are implemented, but documentation is incomplete and examples are absent.
This project borrows some ideas from the great egui-data-table. Check it out if you don't need CSV/XLS import with column mapping or want to show some data based on a vector. The idea behind the TableModel trait in this crate is to allow more advanced data retrieval, for example from a database.
| Version | egui |
|---|---|
| 0.1 | 0.33 |
| 0.2 | 0.36 |
