ui icon indicating copy to clipboard operation
ui copied to clipboard

Data table row selection, totally breaks when selecting a row

Open MrlolDev opened this issue 1 year ago • 4 comments

I followed the component example and it freezes the entire page once i click on one of the select icons.

  const table = useReactTable({
    data: dataWithToken,
    columns: columns,
    onSortingChange: setSorting,
    onColumnFiltersChange: setColumnFilters,
    getCoreRowModel: getCoreRowModel(),
    getPaginationRowModel: getPaginationRowModel(),
    getSortedRowModel: getSortedRowModel(),
    getFilteredRowModel: getFilteredRowModel(),
    onColumnVisibilityChange: setColumnVisibility,
    onRowSelectionChange: setRowSelection,
    enableRowSelection: true,
    enableMultiRowSelection: true,
    state: {
      sorting,
      columnFilters,
      columnVisibility,
      rowSelection,
    },
  });

```

```
 {
    id: "select",
    header: ({ table }) => (
      <Checkbox
        checked={table.getIsAllPageRowsSelected()}
        onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
        aria-label="Select all"
      />
    ),
    cell: ({ row }) => (
      <Checkbox
        checked={row.getIsSelected()}
        onCheckedChange={(value) => row.toggleSelected(!!value)}
        aria-label="Select row"
      />
    ),
    enableSorting: false,
    enableHiding: false,
  },
```

MrlolDev avatar Nov 16 '23 17:11 MrlolDev

Same error

malezjaa avatar Nov 27 '23 17:11 malezjaa

unable to reproduce. please provide more context

lookevink avatar Dec 03 '23 06:12 lookevink

Using id: "select" for column doesn't work at all for me. The column doesn't even appear. I have to rename my column to smth else, i.e. "selection".

varna avatar Jan 03 '24 09:01 varna

I had a problem with Checkbox column not appearing, and the problem was that I imported { Checkbox } from radix-ui, instead of @/components/ui. Hope it will help someone

glebshkut avatar Jan 16 '24 14:01 glebshkut

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Feb 12 '24 23:02 shadcn

Has anyone solved this error yet? Help!!!

TrungNguyen1811 avatar Apr 05 '24 10:04 TrungNguyen1811

Perhaps the problem is due to infinite re-rendering of your table when any change is made to your table's state. This can be resolved by wrapping your data and column within the useMemo hook.

Check here for more info.

Ziyang-98 avatar Apr 08 '24 03:04 Ziyang-98

I had a problem with Checkbox column not appearing, and the problem was that I imported { Checkbox } from radix-ui, instead of @/components/ui. Hope it will help someone

Omg, this is what happened to me... X_X

TonnyMunkNielsen avatar Aug 04 '24 23:08 TonnyMunkNielsen

https://www.instagram.com/1900_officelle?igsh=MW5ueDI0b21qbW44Zg==

TonnyMunkNielsen @.***> schrieb am Mo., 5. Aug. 2024, 01:30:

I had a problem with Checkbox column not appearing, and the problem was that I imported { Checkbox } from radix-ui, instead of @/components/ui. Hope it will help someone

Omg, this is what happened to me... X_X

— Reply to this email directly, view it on GitHub https://github.com/shadcn-ui/ui/issues/1960#issuecomment-2267924548, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIO77CJOJBORUGV7EJCRXI3ZP22P3AVCNFSM6AAAAAA7OQ6ZW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRXHEZDINJUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nullnullsieben avatar Aug 05 '24 10:08 nullnullsieben