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.

defaultColumns not able to access tabs > row > field value

default discord avatar
arcayne.last year
3

This is a similar issue to

https://discord.com/channels/967097582721572934/1082661558250905703

, that was fixed, but with an extra layer of also being inside of a tab.


Let me know if this

should

be possible and I'm just doing it wrong. Otherwise, I can open an issue.



In this example,

text

and

link

aren't recognized as a

defaultColumn

option.


import { CollectionConfig } from 'payload'

export const Buttons: CollectionConfig = {
  slug: 'buttons',
  admin: {
    defaultColumns: ['text', 'link', 'updatedAt'],
  },
  fields: [
    {
      type: 'tabs',
      tabs: [
        {
          name: 'content',
          label: 'Content',
          fields: [
            {
              type: 'row',
              fields: [
                {
                  name: 'text',
                  label: 'Text',
                  type: 'text',
                  required: true,
                },
                {
                  name: 'mobileText',
                  label: 'Mobile text',
                  type: 'text',
                },
              ],
            },
            {
              name: 'link',
              label: 'Link',
              type: 'text',
            },
            {
              name: 'file',
              type: 'upload',
              relationTo: 'media',
            },
          ],
        },
      ],
    },
  ],
}

export default Buttons
  • default discord avatar
    zed0547last year

    I think this is happening because your interpretation of what the tabs field is doing is slightly wrong here. You have a

    named

    tab, which would make your link appear as

    content.link

    instead of

    just

    link

    which is why you're running into issues. If you don't want your tabs to have an impact on your data model, then you can remove the

    name

    from the tab and just leave it with a

    label
  • default discord avatar
    arcayne.last year

    Thank you

    @654031862146007055

    ! That fixed my problem, as well as my interpretation.

  • default discord avatar
    zed0547last year

    It's my pleasure!

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.