Skip to content

Column filtering breaks after column reordering #505

Closed
@Chee7ah

Description

@Chee7ah

Describe the bug
After reordering columns, the filtering either: works, filters another column, breaks altogether (as the below demo illustrates).

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://material-table-core.com/demos/filter/custom-filter/
  2. Drag a column around (e.g. Birth Year)
  3. Try filtering
  4. See error

Expected behavior
Filtering continues to filter the moved column.

Screenshots
at9EF35svq

Desktop (please complete the following information):

  • OS: MacOS 12.2.1
  • Browser: Chrome
  • Version: 98.0.4758.109

Additional context
When filtering we pass the columnId to the filter function.
This eventually ends up in the dataManager's changeFilterValue function, which uses the columnId as an index.
This is where the mismatch happens. The columnId is not necessarily the same as the column index at this point and it ends up trying to filter a different column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions