[v8]: columnVisibility doesn't work when accessorKey is a nested field #4621
-
Hi, In my current project, I have a column with the following My issue is I can't use this But when using the Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@simplecommerce did you figure this out? I'm having the same issue, I have a column with accessKey "address.city" and I'm trying to hide it by default. I tried passing the full obj like this:
I also tried this:
The column still visible. |
Beta Was this translation helpful? Give feedback.
-
Thanks for clue guys! In {
id: "productCount", // must be present if using accessorFn
accessorFn: (row) => row._count?.products ?? "-",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Products" />
),
size: 100,
cell: ({ row }) => {
const count = row.getValue("productCount") as number;
return (
<span className="font-medium">{count}</span>
);
},
}, |
Beta Was this translation helpful? Give feedback.
That was great advise! Thanks! I console.log my columnVisibility of my view columns component.
and notice the id was "address_city". Now my initial state is set like this and it works!