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

Handle column sorting events directly on the header cell #3316

Merged
merged 4 commits into from
Aug 22, 2023

Conversation

nstepien
Copy link
Contributor

No description provided.

@nstepien nstepien self-assigned this Aug 22, 2023
src/HeaderCell.tsx Outdated Show resolved Hide resolved
@nstepien nstepien marked this pull request as ready for review August 22, 2023 17:48
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #3316 (504771c) into main (7b3e0d2) will increase coverage by 0.21%.
The diff coverage is 86.27%.

@@            Coverage Diff             @@
##             main    #3316      +/-   ##
==========================================
+ Coverage   83.54%   83.75%   +0.21%     
==========================================
  Files          45       45              
  Lines        4588     4568      -20     
  Branches      719      717       -2     
==========================================
- Hits         3833     3826       -7     
+ Misses        755      742      -13     
Files Changed Coverage Δ
src/style/cell.ts 100.00% <ø> (ø)
src/renderHeaderCell.tsx 75.86% <66.66%> (-2.40%) ⬇️
src/HeaderCell.tsx 91.21% <88.88%> (+4.37%) ⬆️

website/root.tsx Outdated Show resolved Hide resolved

if (offset > 11) {
// +1px to account for the border size
return;
}

// prevent selecting/sorting if we started resizing the column, including double-clicking
ignoreClickRef.current = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not use a ref currently. Is there a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it, after resizing the column, the click event is triggered on the header cell.
This wasn't an issue before as the click event handler was on a child element

amanmahajan7
amanmahajan7 previously approved these changes Aug 22, 2023
@amanmahajan7 amanmahajan7 merged commit c7a8e82 into main Aug 22, 2023
3 checks passed
@amanmahajan7 amanmahajan7 deleted the header-sort-on-cell branch August 22, 2023 19:52
adityatoshniwal pushed a commit to pgadmin-org/react-data-grid that referenced this pull request Jul 31, 2024
* Handle column sorting events directly on the header cell

* fix main styles

* add resize handler element

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

Successfully merging this pull request may close these issues.

2 participants