Skip to content

DataView filters: match rows where the field is an array #943

Open

Description

@ravisuhag

Right now a select/multiselect filter only works when each row has one value in that column. A lot of real data has several: tags on a ticket, labels on an issue, all the projects someone is on.

What happens today

Say a row has labels: ['bug', 'urgent'] and you filter labels with "is any of: urgent". The in check does String(row.getValue(columnId)), which turns the array into "bug,urgent". It never matches. eq has the same problem.

There's also no way to pass a custom filterFn for a field, so you can't work around it from the outside.

What I'd expect

When the cell value is an array:

  • in (is any of): match if any item in the row is in the selected set
  • notin (is none of): match if no item in the row is in the selected set
  • eq / neq for select: same idea with one value

Strings and numbers keep working exactly like they do now, so nothing changes for existing tables.

Grouping by an array field is a separate question (one row in several groups?). I'd leave that out of this, and maybe just not allow groupable on array fields for now.

Possible shape

Probably just checking Array.isArray(cellValue) inside the select and multiselect operations. Or an explicit flag like field.multiValue: true, if you'd rather be strict about it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions