-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Columns are sorted when clicking header filters #3521
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
Comments
Share Codepen link, It would be more helpful |
Can you create a reproducible example? |
@amanmahajan7 @nstepien we're having a similar issue/need. we don't want the entire header cell to be clickable for sorting purposes, since there are additional buttons/controls in there for other things, such as pulling up a filter popup. it would be very useful to delegate what should trigger sorting to the user-supplied children of HeaderCell via a render prop or callback arg like currently i think the only way to do this is by hackily binding listeners in the children with stopPropagation to prevent the built-in sort behavior (both click and keypress). some flexibility here would be much appreciated. i see there are some related issues with filters in header cells, so feels like it's not such an edge case:
if this is already possible, please add a demo that shows how you recommend adding interactive elements to the header while also avoiding sorting. thank you(s)! example: |
Closing due to lack of reproducible example. I thin this solution should work |
Describe the bug
To Reproduce
Expected behavior
Not sort the column
Environment
react-data-grid
version: ^7.0.0-beta.44react
/react-dom
version: ^18.2.0Additional context
The problem comes from this line
react-data-grid/src/HeaderCell.tsx
Line 279 in b667cec
onClick is on top of everything so anything you put inside the header div will be activated as soon as you click the cell, even the filter which is inside the header renderer
Video:
Monosnap.screencast.2024-06-06.08-43-19.mp4
The text was updated successfully, but these errors were encountered: