Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Clickable cell custom component

default discord avatar
philiposauruslast year
1

How does one swap the 1 column cell in the overview page and retain the "clickableness" (link) of it?



When swapping to just a span you obviously can't click it so there is no way to get to the detail/document page anymore. I tried adding the Link component from NextJS but that is not working. The URL changes but you are not actually taken to the detail page.



It is probably important to mention I am using Payload within Next with

https://github.com/payloadcms/next-payload

import Link from 'next/link';

const OrderedByCell = (props: Props) => {
  const { cellData, rowData } = props;
  return (
    <Link href={`/admin/collections/orders/${rowData.id}`}>
      {cellData.name} - {cellData.email}
    </Link>
  );
};

export default OrderedByCell;


^ shameless bump

  • discord user avatar
    jesschow
    last year

    If you only need the custom component to join

    name + email

    , you could instead create a virtual field that combines the values of these two fields, and then use default columns to rearrange your new field as the first column - by default, the first column will be linked to the doc



    {
      name: 'title',
      type: 'text',
      hooks: {
        afterRead: [
          ({ data }) => {  
            return `${data.name} - ${data.email}`;
          }
        ],
      },
    }
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.