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 working

default discord avatar
eddiedev2 years ago
12

Hi I've set my defaultColumns to the following for Media Collection List Page under admin: defaultColumns: ['title', 'customId', 'description', 'fileName'].


However, it doesn't do anything.


Any ideas?


Ty.

  • discord user avatar
    tylandavis
    2 years ago

    You may need to drop the

    _preferences

    collection in MongoDB. I don't know if there's an easy way to do this, I use Atlas so I just do it from the mongodb website.

  • discord user avatar
    dribbens
    2 years ago

    If you delete your user and recreate it, preferences will get reset.



    but otherwise, dropping that table is the way

  • default discord avatar
    eddiedev2 years ago

    got it thank you!

  • default discord avatar
    ragingpotato.last year

    is there anyway to do this without deleting the user and recreating it?

  • default discord avatar
    notchrlast year
    @446817950071128065

    Do you mean dropping user preferences?

  • default discord avatar
    ragingpotato.last year

    yes

  • default discord avatar
    notchrlast year

    As like a one time thing? Or in general



    Because dropping the _preferences collection will surely do it



    Ideally you wouldn't be in this kind of in-between state with preferences



    But it can happen with changes to collections, etc

  • default discord avatar
    ragingpotato.last year

    not really a one time. maybe when a user sets its preference on different order



    because the problem really for me is when a user logs out and logs back in, the columns are back to its default setup

  • default discord avatar
    notchrlast year

    Hmmm



    So not only can you not change the preferences, they don't persist when changed?

  • default discord avatar
    ragingpotato.last year

    yes. is there an config for that or does it save on default?

  • default discord avatar
    notchrlast year

    Hmm



    Well there is an API for dealing with user preferences



    https://payloadcms.com/docs/admin/preferences#managing-user-preferences

    It provides methods like setPreference



    After reading through that, will you let me know if you're still stuck?

  • default discord avatar
    ragingpotato.last year

    will do! thank you so much!

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.