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

Number sort type does not handle negative values #3352

Closed
amy-mac opened this issue Jun 29, 2021 · 3 comments
Closed

Number sort type does not handle negative values #3352

amy-mac opened this issue Jun 29, 2021 · 3 comments
Labels

Comments

@amy-mac
Copy link

amy-mac commented Jun 29, 2021

Describe the bug (required)
A new number sort function was added to sortTypes to handle numbers since the default alphanumeric sort type does not handle floats. However, the number sort function does not handle negative numbers and treats the negative number the same way as its positive counterpart because the numbers are converted to strings that then get stripped of the negative sign with this regex

Provide an example via Codesandbox! (required)
Use a new react-table codesandbox to reproduce the issue.
This create codesandbox link is not working ⬆️

Steps To Reproduce (required)
Steps to reproduce the behavior:

  1. Have a column that has "number" as its sortType
  2. Have values in the cell that are negative as well as positive
  3. Try to sort
  4. See error

Expected behavior (Recommended)
I would expect a sorting function that handles numbers to be able to sort negative numbers as lower values than positive numbers.

@Jeffdude
Copy link

Jeffdude commented Jul 1, 2021

Ensure the value returned by the accessor is a Number type, then use sortType: 'basic'

Fixed docs in #3359

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

This issue is being marked as stale (no activity in the last 14 days)

@github-actions github-actions bot added the Stale label Apr 8, 2022
@github-actions
Copy link

github-actions bot commented Apr 8, 2022

This issue has been detected as stale and automatically closed. It's very likely that your issue has remained here this long because it would require breaking changes to v7. React Table v8 is currently in alpha (soon beta!) and already contains bug fixes, performance improvements and architectural changes that likely address this issue.

  • If your v7 issue has been previously labeled as requiring breaking changes, please try the new v8 alpha/beta releases
  • If your v7 issue has not already been labeled as a breaking change, open a new issue.
  • If this was a v8 issue and was closed by mistake, please reopen or leave a comment below.

@github-actions github-actions bot closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants