Skip to content

Offer "Facet by this" for the first column of a view - #3051

Closed
X6M-Work wants to merge 1 commit into
simonw:mainfrom
X6M-Work:fix-facet-selected-2011
Closed

X6M-Work wants to merge 1 commit into
simonw:mainfrom
X6M-Work:fix-facet-selected-2011

Conversation

@X6M-Work

@X6M-Work X6M-Work commented Nov 8, 2026

Copy link
Copy Markdown

Fixes #1785.

The column menu hid "Facet by this" for whichever column came first in the table header:

var isFirstColumn = th.parentElement.querySelector("th:first-of-type") === th;

On a table page that first column is either the Link column (rowid or compound primary key tables) or the single primary key, so skipping it was right there. A view has neither: its first header is an ordinary column, and that column could not be faceted from the menu. For example, on /fixtures/paginated_view the menu for content only offered sorting, while content_extra offered "Facet by this".

The check now skips the link column itself, using the data-is-link-column attribute that _table.html already sets. The single primary key case is still covered by the existing isSinglePk check, so table pages offer the same items as before.

Tests

Two Playwright tests in tests/test_playwright.py:

  • test_facet_by_this_offered_for_first_column_of_view: the content menu on paginated_view offers "Facet by this", and clicking it adds _facet=content. It fails on main.
  • test_facet_by_this_not_offered_for_single_primary_key: the pk menu on facetable still has no facet item.

black --check, ruff check and prettier --check pass.

The column menu skipped whichever column came first in the header. On
table pages that is the Link column or the single primary key, but a
view has neither, so its first column could not be faceted from the
menu. Skip the link column itself instead.

Fixes simonw#1785
@simonw

simonw commented Nov 23, 2026

Copy link
Copy Markdown
Owner

I've landed #2810 (2a23e09) now with a fix for this.

@simonw simonw closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use cog menu to facet by first column in a view

2 participants