Sort table with ratios (10:1)?
Sort table with ratios (10:1)?

I'm trying to understand if I can sort a table with a column that contains ratios throughout it. I notice that when it attempts to sort, it'll sort numerically (1-9) ignoring the numbers as hundreds or thousands (1,000 versus 900).
For example:
Column A | Column B | Column C |
---|---|---|
Example 1 | $10,000,000 | 1,500:1 |
This discussion has been closed.
Answers
Its probably sorting as a string. Not really sure how you would want to sort ratios, ie,
1,500:1
versus1,500:2
but there are a couple options. You can use Orthogonal Data for thesort
type to restructure the string to something that sorts as you want. Or you can create a Sorting Plugin. You might find an example here that will help:https://datatables.net/plug-ins/sorting/
Kevin
@kthorngren, thank you for that suggestion. It got me looking into those docs and I discovered
data-order
which allowed me to sort the table as expected and still keep the styling I wanted.Sample:
<td data-order"1500">1,500:1</td>
Perfect, glad you got it working.
Kevin