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

Got incorrect sort when the content of cell is the numeric value of the float type. #818

Open
noeyy-mino opened this issue Jun 30, 2024 · 0 comments

Comments

@noeyy-mino
Copy link

noeyy-mino commented Jun 30, 2024

I insert one cell to store the numeric value of the float type in summary section as following shown.
cells.insert(11, '<th class="sortable" data-column-type="speedup">speedup</th>')

And the speedup is the numeric value of the float type.

In genericSort fuction, convert the value of cell into lowcase, I think should check whether the value is a numeric type.
If yes, should return parseFloat(a[key]) - parseFloat(b[key])

sorted = list.sort((a, b) => { if (!isNaN(parseFloat(a[key])) && !isNaN(parseFloat(a[key]))){ return parseFloat(a[key]) - parseFloat(b[key]) } return a[key] === b[key] ? 0 : a[key] > b[key] ? 1 : -1 })

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

No branches or pull requests

1 participant