Can't set admin defaultColumns for collections

default discord avatar
.kilosierra12 months ago
2

I'm assuming that the admin defaultColumns are the columns displayed in the admin ui for its given collection.



If I add 'clientName' to the defaultColumn array and set useAsTitle: 'clientName', nothing seems to happen



const CaseStudies: CollectionConfig = {
    slug: 'case-studies',
    admin: {
        defaultColumns: ['clientName', 'author', 'category', 'status'],
        useAsTitle: 'clientName',
    },
    access: {
        read: () => true,
    },
    fields: [
        {
            name: 'clientName',
            type: 'text'
        },
        {
            name: 'clientWebsite',
            type: 'text'
        },

My admin UI only displays the author, category and status column as can be seen in the screenshot. No clientName.



What am I doing wrong?

  • discord user avatar
    jarrod_not_jared
    12 months ago

    Have you previously selected columns to show using the column filter pill button?



    When you do that it saves your preferences in the DB. You can clear your preferences or log in with a new user to see them in the new order. There has been a little bit of chatter on github discussions. Some people have proposed adding a button that allows you to reset to display default columns. But as of right now you would need to clear the user preference in the DB or manually add the new column using the filters pill button.

  • default discord avatar
    .kilosierra12 months ago

    Adding the new column via the filters button worked. Thanks 👍

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.