-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix(table viz): correctly sort by multiple columns in a table #19920
fix(table viz): correctly sort by multiple columns in a table #19920
Conversation
Recent commit to sort alphanumeric columns via case insensitive comparison broke the multi-column sort option. React-table only sorts by the second (or third...) column if the first column matches. Since the alphanumeric sort only returned -1 or 1, it never would move to the subsequent columns when the earlier column values matched.
For reference, there's something on the react-table repo about this too |
Codecov Report
@@ Coverage Diff @@
## master #19920 +/- ##
=======================================
Coverage 66.52% 66.52%
=======================================
Files 1714 1714
Lines 65052 65052
Branches 6722 6721 -1
=======================================
Hits 43279 43279
Misses 20061 20061
Partials 1712 1712
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@stephenLYZ @kgabryje anything else you think this needs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Work! Looks good to me!
Recent commit to sort alphanumeric columns via case insensitive comparison broke the multi-column sort option. React-table only sorts by the second (or third...) column if the first column matches. Since the alphanumeric sort only returned -1 or 1, it never would move to the subsequent columns when the earlier column values matched. (cherry picked from commit a45d011)
Recent commit to sort alphanumeric columns via case insensitive comparison broke the multi-column sort option. React-table only sorts by the second (or third...) column if the first column matches. Since the alphanumeric sort only returned -1 or 1, it never would move to the subsequent columns when the earlier column values matched. (cherry picked from commit a45d011)
Recent commit to sort alphanumeric columns via case insensitive
comparison broke the multi-column sort option. React-table only sorts
by the second (or third...) column if the first column matches.
Since the alphanumeric sort only returned -1 or 1, it never would move
to the subsequent columns when the earlier column values matched.
SUMMARY
prior commit only returned -1 or +1, resulting in a value of -1 when two rows had the same value for a given column.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Unsorted:
Sorted by Platform:
Sorted by Platform AND Global Sales (broken):
Sorted by Platform and Global Sales (fixed):
TESTING INSTRUCTIONS
I added a new test to check for properly sorting by multiple columns (using react-table's
ADDITIONAL INFORMATION