Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to have column in OnColumnResizeCallback #3331

Closed
kokosin4ik opened this issue Sep 1, 2023 · 2 comments · Fixed by #3644
Closed

Want to have column in OnColumnResizeCallback #3331

kokosin4ik opened this issue Sep 1, 2023 · 2 comments · Fixed by #3644

Comments

@kokosin4ik
Copy link

kokosin4ik commented Sep 1, 2023

Use case

Hello: steps to reproduce:

  1. Open https://adazzle.github.io/react-data-grid/#/row-grouping. Uncheck Country and Year checkboxes and check Athlete.
  2. In our RawColumnsConfig athlete has index 4. If we froze that column or group by it and resize - inside onColumnResize we are getting idx=1, which is obviously the viewport column index.
  3. In my case I'm saving user table configuration to my backend and if I will use idx=1 to save column width - I will save it to wrong column (country in this case), because in my RawColumnConfig another column at that index

I dont sure that its a bug that we are getting viewport index, so i dont think we need to change idx calculated to pass inside onColumnResize

Proposed solution

I suggest also pass the column object to onColumnResize callback. With that object we can easily define column by 'key'

#3330

@kokosin4ik
Copy link
Author

Or we can just pass column key instead of full column

@ericnjeru
Copy link

I have a scenario where I expand/collapse grouped columns into a single column, this affects the indexing on onColumnResize.
If possible a key instead of the index as suggested by @kokosin4ik would be great.

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

Successfully merging a pull request may close this issue.

2 participants