question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for variable number of decimal places

See original GitHub issue

Description

I have a scientific database with tables of data. We format the numbers for decimal places, but we provide a tooltip to see the un-manipulated value. Those values have a variable number of decimal places, which apparently, the default bootstrap-table sort mechanism doesn’t support, so I tried adding your natural sort functionality to get the correct numeric sort… however, it seems that natural sort has the same issue. I’m not entirely sure what is dictating the sort behavior. At first, I thought it was the number of digits (ignoring the decimal), but the fixed-width font below shows that’s not the case, so I’m not entirely sure what’s going on… This yields an incorrect sort, as seen here:

decimalsortbehavior

I clipped out the middle of the image to be able to see the header and the mis-sorted values.

So for example, in the screenshot above, the values it’s using for sorting are:

481379.86936945
481379.86936945
4001067.45756464
83861369.518249
941478.5191909212
11550635.0368925

I intend to either add a hidden value in front as a work-around or implement a custom-sort.

I apologize if this behavior is already defined as a known limitation of the sort (which is why I’m submitting this as a feature request as opposed to a bug - I’m guessing this is a known limitation).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
UtechtDustincommented, Dec 16, 2021

As i said the option is similar to your requested feature. Instead of sorting of data attribute the column will be sorted by a other column. Example: https://live.bootstrap-table.com/code/UtechtDustin/10000

1reaction
UtechtDustincommented, Dec 16, 2021

Please provide us an example using our editor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify variable number of decimal places to printf
If you use * for your field precision specifier, it tells printf that it is variable. You then specify an additional preceding int...
Read more >
Decimal Data Type - Visual Basic | Microsoft Learn
The Decimal data type provides the greatest number of significant digits for a number. It supports up to 29 significant digits and can ......
Read more >
Support for Number Fields with Variable Decimal Places
Number fields use a specified number of decimal places but money values vary by currency (e.g. dollars=2dp, yen=0dp). It would be great if...
Read more >
Why do my statistics display with four decimal places? - IBM
When choosing how many decimals to display, SPSS will display the number of decimals you have the variable formatted as, plus two additional ......
Read more >
4.8 — Floating point numbers - Learn C++
When using floating point literals, always include at least one decimal place (even if the decimal is 0). This helps the compiler understand ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found