Skip to content

[BUGFIX] Show the "deactivate current filter" button with the form filter - #7052

Open
nboisteault wants to merge 1 commit into
3liz:masterfrom
nboisteault:bugfix-6775-unfilter-button-form-filter
Open

[BUGFIX] Show the "deactivate current filter" button with the form filter#7052
nboisteault wants to merge 1 commit into
3liz:masterfrom
nboisteault:bugfix-6775-unfilter-button-form-filter

Conversation

@nboisteault

Copy link
Copy Markdown
Member

Problem

Fixes #6775.

The "Deactivate current filter" button (#layerActionUnfilter, in the layer switcher dock) does not show up when the filter is applied from the form filter panel, while it does show up when the filter comes from the attribute table or the selection.

Root cause

The button's visibility is driven solely by the lizMap.lizmapLayerFilterActive global, and it was toggled in a single place: attributeTable.js (updateLayer()). That code is only reached by the "full" filtering path, which builds the filter from a list of feature ids.

The form filter panel picks its method in getFilterMethod() (filter.js): it defaults to "simple", and only uses "full" when the layer has an attribute table config with a single-column primary key. The "simple" path applies a WMS/WFS expression filter via lizMap.triggerLayerFilter() / lizMap.deactivateMaplayerFilter() (map.js), which never touched lizmapLayerFilterActive nor the button.

Fix

The button state is now updated in the two 'simple' branches of filter.js.

The low-level map.js helpers are deliberately left untouched: timemanager.js calls triggerLayerFilter() on every time step, so updating the button there would make it flicker while the Time Manager plays.

Nothing else was needed — clicking the button already worked once visible: it triggers layerfeatureremovefilter, which attributeTable.js already handles to clear the map filter (exp_filter/filtertoken/filter + expressionFilter) and filter.js already handles to reset the form fields.

Test

Added a Playwright test in form-filter.spec.js.

The existing form_filter fixture has single-column primary keys on both layers, so getFilterMethod() always resolves to "full" there — which is why the existing tests never covered this. The new test forces the "simple" path with filterConfigData.filterMethod = 'simple', the extension point already documented in filter.js for project custom scripts, so the existing tests on that fixture keep exercising "full" unchanged.

Verified locally: the new test fails on expect(unfilterButton).toBeVisible() without the fix, and passes with it.

Note: Form filter with combobox fails on my local stack because of an echo-proxy setup issue in getEchoRequestParams; it fails identically on a clean master, so it is unrelated to this change.

🤖 Generated with Claude Code

…lter

The `#layerActionUnfilter` button in the layer switcher was only toggled by
the "full" filtering path (attributeTable.js), which builds the filter from a
list of feature ids. The form filter panel defaults to the "simple" method
(see `getFilterMethod()`), which applies a WMS/WFS expression filter through
`lizMap.triggerLayerFilter()` / `lizMap.deactivateMaplayerFilter()` and never
updated `lizmapLayerFilterActive` nor the button.

Update the button state in the two "simple" branches of filter.js only. The
low-level map.js helpers are deliberately left untouched because timemanager.js
calls them on every time step, which would make the button flicker.

Clicking the button already worked once visible: it triggers
`layerfeatureremovefilter`, which attributeTable.js uses to clear the map
filter and filter.js uses to reset the form fields.

Fix 3liz#6775

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added this to the 3.11.0 milestone Jul 29, 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.

[Bug]: The "deactivate current filter" button does not show when the filter is applied from the form filter panel

1 participant