Filter a lookup column from its header
Filter a lookup column from its header. Builds on #30439, where lookup columns hid Filter and Sort. Retarget to main once #30439 merges.
On a lookup column such as Company āŗ Name on People, Filter in the column header opens a filter on the looked-up field, Company ā Name. Its value is compared on each row's company: { company: { name: { ilike: "%Micro%" } } }. Sort stays hidden on lookup columns; it needs a relation target on view sorts, which #30657 adds; #30661 wires it.
Changes
- Header menu: for a lookup column, whether Filter shows is decided by the existing filterable selector, asked about the looked-up field instead of the relation. The looked-up field must be filterable and readable.
- Header action:
useOpenRecordFilterChipFromTableHeadertakes the lookup's target field. It reopens an existing chip only when both the relation and the target match. Otherwise it creates a filter withrelationTargetFieldMetadataId, built by the newcreateEmptyRelationTargetRecordFilter: the looked-up field's type and default operand, labelled "Relation ā Field" as in the advanced filter. - Filter chip: relation-target filters already existed (advanced filter, saved view filters, GraphQL), but the simple chip picked its value input from the relation field. That showed a company picker instead of a text or number input. The new
filterValueFieldMetadataItemUsedInDropdownComponentSelectorreturns the target field when there is one, else the relation field. The filter input, operand list, option list, content width and placeholders read it. The operand dropdown's own inline version of this logic is replaced by the selector. The chip's title shows the filter label ("Company ā Name").
Saving the view saves the filter as usual: view filters already store relationTargetFieldMetadataId.
Stack
| PR | What it does | Builds on |
|---|---|---|
| #30439 | Front: lookup columns, added from the + menu | main |
| š this PR | Front: filter a lookup column from its header | #30439 |
| #30657 | Server: viewSort.relationTargetFieldMetadataId | main |
| #30661 | Front: sort a lookup column from its header | this PR + #30657 |
Size: code +131 ā65, tests +45 (S).
Testing
- Unit:
createEmptyRelationTargetRecordFilterbuilds a filter on the relation with the target's type, operand and "Relation ā Field" label. The object-filter-dropdown, record-filter, advanced-filter, views and record-table header suites pass (57 suites, 322 tests). - Browser check on the dev seed, People with Company āŗ Employees and Company āŗ Name lookup columns:
- The Company āŗ Name header menu shows Filter.
- Filter ā Contains "Micro" sends
{ company: { name: { ilike: "%Micro%" } } }and the table shows the 8 people of Microsoft, MicroStrategy, MICROS Systems and Microworkers. - Filter on Company āŗ Employees opens a number input labelled "Employees".
- Front typecheck, oxlint and oxfmt.
Screenshots
The header menu of a lookup column offers Filter:

Filtering Company āŗ Name:

A number field gets the number input:

Generated by Claude Code
Generated by Claude Code