Commit 179ac05
fix: hide already-filtered values from other spreadsheet column filters (#9386)
## Description
In a `SpreadsheetFilterTable` with filters on multiple columns, opening
any column's filter dropdown showed values from rows already hidden by
other columns as unchecked, suggesting they were filtered by this
column. Re-checking them did nothing because another column still hid
the row.
Applying a second filter then implicitly added those already-hidden rows
to the second column's `filteredRows`, so clearing the first filter did
not bring the rows back — the second column now also filtered them.
Root cause: `ItemFilter` read `spreadsheet.isRowHidden(r)` for both
building option lists and deciding which rows belong in its own
`filteredRows`. That property reflects the union of all column filters,
so each filter could not tell its own work from a sibling's.
Each `ItemFilter` now operates only on its own `filteredRows`. The
dropdown option list omits values whose rows are all hidden by other
columns via a new
`SpreadsheetFilterTable.getRowsHiddenByOtherFilters(self)` helper.
`clearAllFilters` does a second pass to refresh option lists so cleared
siblings are reflected immediately.
Fixes #9329
## Reproduction
```java
@route("spreadsheet-filter-cross-column")
public class SpreadsheetFilterCrossColumnPage extends VerticalLayout {
public SpreadsheetFilterCrossColumnPage() {
Spreadsheet spreadsheet = new Spreadsheet();
spreadsheet.setTheme(SpreadsheetTheme.LUMO);
spreadsheet.setHeight("400px");
spreadsheet.createCell(0, 0, "Column A");
spreadsheet.createCell(0, 1, "Column B");
spreadsheet.createCell(0, 2, "Column C");
spreadsheet.createCell(1, 0, "Alpha");
spreadsheet.createCell(1, 1, "Foo");
spreadsheet.createCell(1, 2, "Alice");
spreadsheet.createCell(2, 0, "Beta");
spreadsheet.createCell(2, 1, "Bar");
spreadsheet.createCell(2, 2, "Bob");
spreadsheet.createCell(3, 0, "Gamma");
spreadsheet.createCell(3, 1, "Baz");
spreadsheet.createCell(3, 2, "Carol");
CellRangeAddress range = new CellRangeAddress(0, 3, 0, 2);
SpreadsheetFilterTable table = new SpreadsheetFilterTable(spreadsheet,
range);
spreadsheet.registerTable(table);
spreadsheet.refreshAllCellValues();
add(spreadsheet);
}
}
```
| Column A | Column B | Column C |
| -------- | -------- | -------- |
| Alpha | Foo | Alice |
| Beta | Bar | Bob |
| Gamma | Baz | Carol |
Steps to reproduce:
- Filter `Beta` in column A.
- Open the filter dropdown in column B → `Bar` shows up unchecked
(before the fix), suggesting column B filtered it.
- Filter `Foo` in column B.
- Re-check `Beta` in column A → the row does not reappear (before the
fix), because column B now also filters it.
🤖 Generated with Claude Code
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8b77a3d commit 179ac05
5 files changed
Lines changed: 139 additions & 23 deletions
File tree
- vaadin-spreadsheet-flow-parent
- vaadin-spreadsheet-flow-integration-tests
- src
- main/java/com/vaadin/flow/component/spreadsheet/tests/fixtures
- test/java/com/vaadin/flow/component/spreadsheet/test
- vaadin-spreadsheet-flow/src/main/java/com/vaadin/flow/component/spreadsheet
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
64 | 117 | | |
65 | 118 | | |
66 | 119 | | |
67 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
68 | 132 | | |
Lines changed: 23 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
255 | 257 | | |
256 | | - | |
257 | | - | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
270 | 268 | | |
271 | 269 | | |
272 | | - | |
| 270 | + | |
| 271 | + | |
273 | 272 | | |
274 | | - | |
| 273 | + | |
275 | 274 | | |
276 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
277 | 279 | | |
278 | 280 | | |
279 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
| |||
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
293 | 301 | | |
294 | 302 | | |
295 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
296 | 307 | | |
297 | 308 | | |
298 | 309 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
154 | 165 | | |
155 | 166 | | |
156 | 167 | | |
| |||
262 | 273 | | |
263 | 274 | | |
264 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
265 | 297 | | |
266 | 298 | | |
267 | 299 | | |
| |||
0 commit comments