Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add getRowId

Kiran K2dcec7096b7c
diff --git a/apps/web/ui/partners/payout-invoice-sheet.tsx b/apps/web/ui/partners/payout-invoice-sheet.tsx
index 1a848da61b..d46a32ca2b 100644
--- a/apps/web/ui/partners/payout-invoice-sheet.tsx
+++ b/apps/web/ui/partners/payout-invoice-sheet.tsx
@@ -176,6 +176,7 @@ function PayoutInvoiceSheetContent({ setIsOpen }: PayoutInvoiceSheetProps) {
onRowSelectionChange: (rows) => {
setSelectedPayouts(rows.map((row) => row.original));
},
+ getRowId: (originalRow) => originalRow.id,
} as any);
return (
diff --git a/packages/ui/src/table/table.tsx b/packages/ui/src/table/table.tsx
index 0dbc52acd1..a1c9a9ac65 100644
--- a/packages/ui/src/table/table.tsx
+++ b/packages/ui/src/table/table.tsx
@@ -56,6 +56,7 @@ type UseTableProps<T> = {
resourceName?: (plural: boolean) => string;
onRowClick?: (row: Row<T>, e: MouseEvent) => void;
onRowSelectionChange?: (rows: Row<T>[]) => void;
+ getRowId?: (row: T) => string;
className?: string;
containerClassName?: string;
@@ -87,6 +88,7 @@ export function useTable<T extends any>(
columnPinning,
pagination,
onPaginationChange,
+ getRowId
} = props;
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(
@@ -95,6 +97,8 @@ export function useTable<T extends any>(
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
+ console.log(rowSelection)
+
// Update internal columnVisibility when prop value changes
useEffect(() => {
if (
@@ -139,6 +143,7 @@ export function useTable<T extends any>(
manualPagination: true,
autoResetPageIndex: false,
manualSorting: true,
+ getRowId
});
return {