Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataViews: display column header when the field is only filterable #57051

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/dataviews/src/view-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ const sortIcons = { asc: chevronUp, desc: chevronDown };
function HeaderMenu( { field, view, onChangeView } ) {
const isSortable = field.enableSorting !== false;
const isHidable = field.enableHiding !== false;
if ( ! isSortable && ! isHidable ) {
return field.header;
}
const isSorted = view.sort?.field === field.id;
let filter, filterInView;
const otherFilters = [];
Expand All @@ -74,6 +71,10 @@ function HeaderMenu( { field, view, onChangeView } ) {
}
const isFilterable = !! filter;

if ( ! isSortable && ! isHidable && ! isFilterable ) {
return field.header;
}

if ( isFilterable ) {
const columnFilters = view.filters;
columnFilters.forEach( ( columnFilter ) => {
Expand Down
Loading