Configurable virtualized data grid for the GPUI toolkit.
sqlly-datatable provides a self-contained Entity<GridState> widget that
you can drop into a GPUI application. It supports:
- Virtualized rendering for large datasets.
- Cell, row, column and rectangular drag selection.
- Sorting on column headers, with a cycle through ascending, descending, and unsorted.
- Per-column filtering via a rich filter panel (operator predicates, value checklist, search) opened from the built-in context menu.
- Expandable row sections created by grouping on any column from its
built-in context menu or through [
GridState::set_grouped_column]. - Configurable column resizing, mouse-driven scrollbars, and edge-scroll during drag selection.
- Clipboard copy of any selection (with or without headers).
- An optional pivot tab ([
SqllyDataTableBuilder::pivot]): a cross-tabulation view with a drag-and-drop field sidebar (rows / columns / values / filters), count/sum/avg/min/max aggregation, expandable row and column groups, subtotals and grand totals, sorting on labels or values, source-value filters, and CSV export. The pivot reads a shared snapshot of the grid's rows and never mutates them; switching tabs preserves both views' state. Configure it programmatically via [pivot::PivotConfig] and read the live layout back from [pivot::PivotState::config]. Pivot row height and column width can be initialized on the builder, resized in the view, and read or updated through [pivot::PivotState]. Right-clicks surface to a [pivot::PivotContextMenuProvider] with full context (grouping paths, aggregated value, driving source rows), and double-clicking any value cell drills through: the flat grid is filtered to exactly the rows behind that cell and brought to the front.
The crate is intentionally GPUI-only on the UI side; the pure formatter in
[mod@format] is usable in any context (export pipelines, server-side preview,
etc.). All formatting is configurable per column by composing the
[config::GridConfig] defaults with [config::ColumnOverride] entries.
Quick start
use gpui::App;
use sqlly_datatable::{
CellValue, Column, ColumnKind, GridConfig, GridData, SqllyDataTable,
};
let data = GridData::new(
vec![Column { name: "id".into(), kind: ColumnKind::Integer, width: 80.0 }],
vec![vec![CellValue::Integer(1)], vec![CellValue::Integer(2)]],
).expect("rectangular data");
let app = gpui::Application::new();
app.run(|cx: &mut App| {
let _view = SqllyDataTable::builder(data)
.config(GridConfig::default())
.build(cx);
});
See crates/sqlly-datatable-sample for a runnable demo.