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

Sortable table: Using parseFloat to evaluate cell values removes parts of values if there is a number prefix #1107

Closed
1 task done
natclamp-moj opened this issue Jan 22, 2025 · 1 comment
Labels
bug A task that fixes something that isn't working

Comments

@natclamp-moj
Copy link
Contributor

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:

Description

The getCellValue function includes a parseFloat which removes any non-number after a number within a value (e.g. '123ABC' becomes '123') which means the sorting of these values is impossible.

Steps to Reproduce

  1. Use the sortable table component and have data of different types in one column, such as number, string with number prefix, string, empty string, etc.
  2. Sort the table using this column

Expected behaviour: If you log out the cell values, any cells with strings beginning with numbers (e.g. '123A') will have been converted to 123 because of the parseFloat used in the getCellValue function. I expect sorting to be on the entire cell value, e.g. '123A' before '123B'.

Actual behaviour: If you have multiple similar values, this means they won't sort correctly (e.g. '123A' and '123B' would just be 123 vs 123)

Reproduces how often: 100%

Versions

3.3.1
OS: Mac Sequoia 15.2
Browser: chrome

@natclamp-moj natclamp-moj added the bug A task that fixes something that isn't working label Jan 22, 2025
@Whersi
Copy link

Whersi commented Feb 4, 2025

The bug was fixed, and the PR has been merged into main.

@Whersi Whersi closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A task that fixes something that isn't working
Projects
None yet
Development

No branches or pull requests

2 participants