Skip to content

Show row counts in AutoFilter dropdowns - #1737

Open
TheRenegadeDev wants to merge 1 commit into
storytold:mainfrom
TheRenegadeDev:fix/filter-value-counts
Open

TheRenegadeDev wants to merge 1 commit into
storytold:mainfrom
TheRenegadeDev:fix/filter-value-counts

Conversation

@TheRenegadeDev

Copy link
Copy Markdown
Contributor

Fixes #1409.

The AutoFilter dropdown now shows a dimmed, right-aligned row count beside every value, including (Blanks). Long checkbox labels truncate before the count, and searching keeps the full count for each matching value. Filter application continues through data.filterBy.

Counts include rows hidden by this column's filter or filters on other columns. This follows the existing dropdown's source list and keeps group sizes stable while changing selections. The existing one-million-data-row scan limit is retained. Counting only rows that pass other columns' filters would require changing that list's semantics as well.

Regression coverage includes repeated values, blank cells, the filter range boundary, checked state after filtering, search, long labels, and alignment of single- and double-digit counts. The dropdown was also rendered offscreen and visually inspected.

Validation:

  • cargo test --locked --workspace: 1,609 passed, zero failed, one existing ignored test.
  • cargo clippy --locked -p gridcraft-engine -p gridcraft-ui-egui --all-targets --no-deps -- -D warnings: passed.
  • Formatting, assets, layers, WASM, parity and keytip checks: passed.

cargo xtask ci passes formatting, then stops at the existing Clippy failures on main in crates/xlsx/src/xls/mod.rs:273 (collapsible_match) and crates/xlsx/src/tests/passthrough_tests.rs:480 (nonminimal_bool). Those files are unchanged in this PR. All skipped gates were run separately and passed. The WASM check retains the existing Modified::Unknown dead-code warning.

@tisca26

tisca26 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for the counts! I've opened #1741 on top of this branch with the other half of #1409: an "Only" button on the hovered value that filters to it in one click. Your commit is included unchanged. If this one lands first, mine shrinks to just the button.

@MichaelMuClaude

Copy link
Copy Markdown

Note for whoever reviews: #1741 builds directly on this PR's commit (unchanged) plus adds the "Only" button from the other half of #1409. I verified #1741's diff today and it includes and passes this PR's own test (filter_value_counts) unchanged. Might be simplest to review/merge #1741 directly rather than both separately, per that PR's own note — merging this one first just means #1741's diff shrinks to its one additional commit.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: AutoFilter dropdowns show row counts. filter_values now returns each distinct display value with its checked state and a count, and the doc says the counts include all data rows in the filter range, even rows hidden by another filter. Excel's dropdown does not show counts (Excel's list shows only the values, while Google Sheets and Power Query show counts), so this is an addition beyond the oracle, which the maintainers may want or not. Counting is linear in the data rows, which is the same as building the list, so the cost is acceptable. The public function signature changes from a pair to a triple, so every caller must change. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

This branch has not been deployed

No deployments
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.

Add Count of Item in Filter function

4 participants