I have a O2M relationship between “Projects” and “Tasks”, so that when viewing a Project item, you see a list of Tasks related to it. However I can’t seem to find a way of preventing Archived items showing up in that O2M list.
I thought I could do it by going into the settings for the field and adding a condition with a filter under Interface Options for tasks where the status does not equal “Archived” but that doesn’t seem to work.
Any suggestions?
3 Answers
3I had this problem as well and didn’t find a solution to it.
The solution would either be, to make the filter work for the display items, and / or to add an parameter to the interface to enable the archive filter (if one exists).
Additionally, I think, the archive button should then be shown as well next to the remove button per item.
In reply to @rijkvanzanten ‘s comment above…
Personally, I think the default should be that Archived items are always hidden when in O2M lists, but I believe you’re telling me that’s not the case..?
Anyway, if that’s true, fair enough … but as far as I can see, there doesn’t seem to be a way to filter items shown in a O2M list at all, regardless of whether you want to filter on the status or some other field.
The filter setting shown above in @carmenh ‘s reply only enables you to apply a filter when selecting existing Tasks to add to the list. I don’t want to allow the user to add an existing Task to a Project at all, I only want to allow them to create new ones, so I have the Selecting Items → Enable Select Button checkbox unticked, which has the effect of removing the Filter option from the Interface pane altogether.
Thus I have no way of filtering what appears in the list of Tasks shown on the Project page.
And even if you DO allow the user to add existing Tasks, there’s still no way of filtering what actually shows in the list. You can filter out Archived Tasks at the point where they select one, but if a Task that is already added to the Project gets Archived later, it will still remain visible in the list on the Project item page.
There doesn’t seem to be a way of filtering what APPEARS in the list of Tasks on the Project item page.
Ahh right yes I see what you're saying. Archive is effectively just a pre-filled filter on the listing view, and not a concept that automatically removes the items from the API or other sources. In this case the request is really closer to make sure the API doesn't return archived items by default, unless explicitly requested which then has the expected behavior
– rijkvanzantenYeah I mean that would be ideal I guess, and tbh it did surprise me that wasn't the case when I first played around with the archiving feature. But that's a pretty big breaking change, and I think all this really needs would be an additional checkbox in this Interface panel to filter out Archived items, and for that checkbox to only appear if "Archive App Filter" is enabled on the related collection.
– Burvs


Thanks for your reply. That's not quite what I need though. That filter only prevents the user from selecting existing archived Posts to add them to the list. What I'm trying to achieve is this: - user Creates a new task under Projects. - user then, at some point, archives that Task. - that Task should no longer appear under the list of Tasks on the Project page.
– BurvsThe setup for that is the same! Directus' archiving functionality just sets the configured archived field to the configured values, which you can then use in the Filter setting above as well
– rijkvanzantenThanks Rijk but this isn't a solution, and I still don't see how it's possible. Will write some more in a reply below...
– Burvs