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.

Default Filter

default discord avatar
etmartinkazoo8 months ago
3

Is it possible to have a default filter on a collection. For example, say a collection is called "tasks" and I want the collection view to always show the tasks whose status is not "completed". Is this possible?

  • discord user avatar
    jesschow
    2 years ago

    Hi

    @1005175744474927194

    , at the moment we don't have a default filter option for collections but this would be a great feature request.



    We did add a

    defaultSort

    option that could work for you in the meanwhile. You would sort by status to at least bring the completed tasks to the top:



    defaultSort: 'status',
    // or descending
    defaultSort: '-status',
  • default discord avatar
    capitalt2160last year

    Default filter would be useful for me too.


    Having said that I really appreciate the ability to re-load filter settings using the URL that is generated when applying filters. It only works when logged in (logging in resets the query parameters) but it's super useful to keep as a bookmark!

  • default discord avatar
    brianjmlast year

    I'm also looking for the ability to set a default filter.



    For example, I only want to display records (by default) that are not archived. But I also need to sort by lastModified. I don't believe there is a way to sort by multiple columns (

    defaultSort: '-archived, lastModified',

    ), so setting the

    defaultSort

    doesn't work for this use case.



    Another example is managing Deals in a CRM. Having a default filter of

    != 'won' || 'lost'

    saves a total of

    10 clicks

    for every visit (if the assumption is that these deals are infrequently accessed). 😉

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.