defaultColumns not working

default discord avatar
eddiedevlast year
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
    last year

    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
    last year

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



    but otherwise, dropping that table is the way

  • default discord avatar
    eddiedevlast year

    got it thank you!

  • default discord avatar
    ragingpotato.last month

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

  • default discord avatar
    notchrlast month

    @Alvin Do you mean dropping user preferences?

  • default discord avatar
    ragingpotato.last month

    yes

  • default discord avatar
    notchrlast month

    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 month

    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 month

    Hmmm



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

  • default discord avatar
    ragingpotato.last month

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

  • default discord avatar
    notchrlast month

    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 month

    will do! thank you so much!

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.