react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Lose focus when filtering rows with grouping

Open Nicolas-Menettrier opened this issue 4 years ago • 2 comments

Describe the bug

I use the datagrid with the grouping example of the website, I added a custom filter outside of the component that filter on a specific column. The rows are updated inside a useMemo with "filters" and "rows" in dependencies.

Everything work as expected when rows are not grouped, but when I group them I got unexpected behavior (lose focus -depends on the character-, sometimes crash with TypeError: Cannot read properties of undefined (reading 'editorOptions')).

To Reproduce

  1. row grouping
  2. input that filter on a specific column outside of the datagrid

Expected behavior

Environment

  • react-data-grid version: ^7.0.0-beta.7
  • react/react-dom version: ^17.0.2

Nicolas-Menettrier avatar Oct 18 '21 09:10 Nicolas-Menettrier

For example, there is row with group name = Utilities. If I search something starting with 'u' it will focus the cell with the name utilities and lose focus on my text input. On can I prevent this behavior ?

If I extend all the other group I do not lose focus btw.

Nicolas-Menettrier avatar Oct 18 '21 09:10 Nicolas-Menettrier

We have also run into this lose focus behavior when we tried upgrading from 7.0.0-canary.49 to 7.0.0-beta.5. We recently tried again with 7.0.0-beta.7 and the issue persists.

For our case, the unexpected lose focus behavior occurs within an editable grid via the following workflow:

  1. Highlight a cell in the grid:
  2. Enter data in a separate search bar control:
  3. After typing a few characters, the focus is lost in the search bar and a cell in the grid becomes focused

aeliasage avatar Nov 01 '21 19:11 aeliasage