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.

I don’t think we can nest group fields in another group field.

default discord avatar
dangerous052 years ago
10

I don’t think we can nest group fields in another group field.

  • default discord avatar
    tyteen4a032 years ago

    Don't use groups is my advice

  • discord user avatar
    tylandavis
    2 years ago

    Hey

    @789268703774375986

    , you actually can do this! Here's an example:



    fields: [
      {
        name: 'topGroup',
        label: 'Top Group',
        type: 'group',
        fields: [
          {
            name: 'field1',
            label: 'Field 1',
            type: 'text',
          },
          {
            name: 'nestedGroup',
            label: 'Nested Group',
            type: 'group',
            fields: [
              {
                name: 'field2',
                label: 'Field 2',
                type: 'text',
              },
            ],
          },
        ],
      },
    ]
  • default discord avatar
    rufella2 years ago

    Always try to reload the express server first 😛

  • default discord avatar
    dangerous052 years ago

    hey



    i just did UI



    i spent the 100 hours overthe last 7 days working on our payload setup



    okay so



    can we use default values



    for blocks



    that returns an object



    i have some dynamic recursive stuff going on



    it doesnt work well so i had to not use group



    hmm



    dont think u can



    add default value for grooups



    yea u have to do default value at each level



    individually



    u cant pass an object to a group



    thats weak



    how do we add default value to ui type

  • discord user avatar
    tylandavis
    2 years ago

    UI field types don't have values, they are just for adding in custom React components. If you want to store value with a custom component, start with a field type that stores value such as

    text

    or

    number

    , whatever the type of data you want to save, and then use

    admin.components

    to customize it.

  • default discord avatar
    dangerous052 years ago

    i eventuallu figured it out thanks

  • default discord avatar
    oatmochalast year

    Hi sorry for following up on an old post, were there any specific reasons or disadvantages to using groups? Will it complicate my config to nest fields within groups?

  • default discord avatar
    simka0997last year
    Don't use groups is my advice

    isn't good advice in my opinion. I mean the use cases of Payload vary so much...



    You do "pay a price" for using them. For example: Payload doesn't allow to display nested fields in the list view atm (V2, not sure about V3).



    You can still create a custom list view or add the column yourself, it's just a little more work.

  • default discord avatar
    tyteen4a03last year

    The generated UI is not as nice



    I don't remember if filtering has improved now

  • default discord avatar
    anders2292last year

    Filtering works in v3 beta, but lisview does not yet.

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.