T
TanStack2y ago
itchy-amethyst

Creating Multiple ColumnDefs for one data type and How to access them in other React Components

Hello! Came from Shadcn-ui's Data Table Component Tutorial, I would like to ask if it's possible to create multiple ColumnDefs for a Data Type? For example:
export const columns: ColumnDef<Payment>[] = [
{
accessorKey: "status",
header: "Status",
},
{
accessorKey: "email",
header: "Email",
},
{
accessorKey: "amount",
header: "Amount",
},
]

export const activeColumns: ColumnDef<Payment>[] = [
{
accessorKey: "status",
header: "Status",
},
{
accessorKey: "email",
header: "Email",
},
{
accessorKey: "amount",
header: "Amount",
},
]
export const columns: ColumnDef<Payment>[] = [
{
accessorKey: "status",
header: "Status",
},
{
accessorKey: "email",
header: "Email",
},
{
accessorKey: "amount",
header: "Amount",
},
]

export const activeColumns: ColumnDef<Payment>[] = [
{
accessorKey: "status",
header: "Status",
},
{
accessorKey: "email",
header: "Email",
},
{
accessorKey: "amount",
header: "Amount",
},
]
In my project, I want to create different tables for a UserProfile[] data type for inactive and active users. Am looking to create different columns so that I can make different actions for the tables. Any suggestion to do this is greatly appreciated.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?