Skip to content

Get filteredRowCount excluding a certain filter #183

@apolo-damasco

Description

@apolo-damasco
Image

Context

I’m trying to display, for each filter option, the number of rows that would be available after applying all other filters on the table. Using table.createCalculation(filterColumn).distinct() works for getting the distinct values, but there’s an issue:

When a user selects a value in a filter, the calculation also respects the current selection within that same filter. This leads to confusing results—for example, a user might see that the option "lorem" has a count of 0, not because other filters exclude it, but simply because they are already filtering by "ipsum" in the same filter.

Problem Description

I haven’t found an efficient way to compute these counts. Using table.createCalculation(column).distinct() includes the filter’s own selections, which results in misleading counts. Manually reconstructing the filter state while excluding a specific filter is possible but inefficient and error-prone.

Request

It would be very helpful to have a built-in helper method in the table class that returns filter option counts ignoring the current filter’s own selections, while still applying all other active filters. This would greatly simplify implementing intuitive filter UIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions