Skip to content

Conversation

@DanRibbens
Copy link
Contributor

Now that array and group fields allow filtering to occur, you may want to set admin.disableListFilter: true to limit the options of the filters in the list view for the collection.

This change makes it so thes property is respected and disables all subfields from appearing in the dropdown.

@jacobsfletch jacobsfletch changed the title fix: disableListFilter for array and group fields fix(ui): disableListFilter for array and group fields May 1, 2025
@DanRibbens DanRibbens requested a review from jacobsfletch May 1, 2025 18:36
if (
(field.type === 'group' || field.type === 'array') &&
'fields' in field &&
!field.admin.disableListFilter
Copy link
Member

@jacobsfletch jacobsfletch May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the proper place for this check, as we still want disabled fields to appear in the WhereBuilder if they exist in the URL. See my comment here:

// Do not filter out `field.admin.disableListFilter` fields here, as these should still render as disabled if they appear in the URL query

In these cases, we render the entire condition as disabled:

I think your goal is to cascade the disableListFilter down to all subfields. To do that, we just need to override the field property itself. Maybe we can do this during sanitization instead? That way it is respected here:

field: reducedFields.find((field) => !field.field.admin?.disableListFilter),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants