Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

improvement: show table selection count, support select all (#198)

Myles Scolnickff928c3eaa70
diff --git a/frontend/src/components/data-table/columns.tsx b/frontend/src/components/data-table/columns.tsx
index fcdd86b46e..ad576cde79 100644
--- a/frontend/src/components/data-table/columns.tsx
+++ b/frontend/src/components/data-table/columns.tsx
@@ -100,6 +100,7 @@ export function generateColumns<T>(
checked={row.getIsSelected()}
onCheckedChange={(value) => row.toggleSelected(!!value)}
aria-label="Select row"
+ className="ml-1"
/>
),
enableSorting: false,
diff --git a/frontend/src/components/data-table/pagination.tsx b/frontend/src/components/data-table/pagination.tsx
index 041f1fae46..5cb93b426e 100644
--- a/frontend/src/components/data-table/pagination.tsx
+++ b/frontend/src/components/data-table/pagination.tsx
@@ -16,8 +16,48 @@ interface DataTablePaginationProps<TData> {
export const DataTablePagination = <TData,>({
table,
}: DataTablePaginationProps<TData>) => {
+ const renderTotal = () => {
+ const selected = table.getSelectedRowModel().rows.length;
+ const isAllSelected = table.getIsAllRowsSelected();
+ const isAllPageSelected = table.getIsAllPageRowsSelected();
+ const count = table.getFilteredRowModel().rows.length;
+
+ if (isAllPageSelected && !isAllSelected) {
+ return (
+ <span>
+ {selected} selected
+ <Button
+ size="xs"
+ variant="link"
+ onClick={() => table.toggleAllRowsSelected(true)}
+ >
+ Select all {count}
+ </Button>
+ </span>
+ );
+ }
+
+ if (selected) {
+ return (
+ <span>
+ {selected} selected
+ <Button
+ size="xs"
+ variant="link"
+ onClick={() => table.toggleAllRowsSelected(false)}
+ >
+ Clear selection
+ </Button>
+ </span>
+ );
+ }
+
+ return `${count} items`;
+ };
+
return (
- <div className="flex items-center justify-end px-2">
+ <div className="flex items-center justify-between px-2">
+ <div className="text-sm text-muted-foreground">{renderTotal()}</div>
<div className="flex items-center space-x-2">
<Button
size="xs"