data-grid
Builds Badge BulkBar Button DataGrid DescriptionList List Table Timeline


The code that drew it
A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.
fn data_grid(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
let detail_theme = theme.clone();
stack(&theme)
.w(px(760.0))
.child(
BulkBar::new("scene.data-grid.bulk", 2)
.total(FIXTURE_JOBS_TOTAL)
.action(
Button::new("scene.data-grid.bulk.retry")
.label("Retry")
.secondary()
.small()
.on_click(|_, _| {}),
)
.action(
Button::new("scene.data-grid.bulk.archive")
.label("Archive")
.secondary()
.small()
.on_click(|_, _| {}),
)
.on_select_all(|_, _| {})
.on_dismiss(|_, _| {}),
)
.child(
DataGrid::new(
"scene.data-grid.jobs",
FIXTURE_JOBS_LOADED,
|index, _, _| grid_row(index),
)
.total(FIXTURE_JOBS_TOTAL)
.columns(grid_columns())
.sorted_by("duration", SortDirection::Descending)
.selection_mode(SelectionMode::Multiple)
.selected(["job-0001", "job-0003"])
.expanded([Expanded::new("job-0002", 2)])
.detail_rows(2)
.detail(move |id, _, _| grid_detail(&detail_theme, id))
.visible_rows(9)
.on_sort(|_, _, _, _| {})
.on_select(|_, _, _| {})
.on_resize(|_, _, _, _| {})
.on_fit(|_, _, _| {})
.on_reorder(|_, _, _| {})
.on_expand(|_, _, _, _| {})
.on_edit_request(|_, _, _, _| {})
.on_edit(|_, _, _| {}),
)
.child(
div()
.type_scale(&theme, gpui_kit_theme::TypeScale::Caption)
.text_color(theme.colors.text_muted)
.child(SharedString::from(format!(
"{FIXTURE_JOBS_LOADED} rows loaded of {FIXTURE_JOBS_TOTAL}; only the drawn \
ones publish"
))),
)
.into_any_element()
}