ui icon indicating copy to clipboard operation
ui copied to clipboard

Ability to hide columns?

Open 3webbg opened this issue 2 years ago • 1 comments

Are we able to define hidden columns?

For example: I want the ID column to be hidden, but be able to get the values whit: row.getValue("id")

{ accessorKey: "id", header: "#" },

3webbg avatar May 24 '23 10:05 3webbg

You should be able to access other data via the original object available on the row

Ie. something like this where a full name column is derived from a combination of two pieces of data

export type User = {
  first_name: string
  last_name: string
}

export const columns: ColumnDef<User>[] = [
  {
    accessorKey: 'last_name',
    header: 'Name',
    cell: ({ row }) => {
      return (
            <span>
              {row.original.first_name} {row.getValue('last_name')}
            </span>
      )
    },
  },

glennforrest avatar May 26 '23 10:05 glennforrest

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 Jun 30 '24 23:06 shadcn