Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The reason for this problem is the cell with “8 diameter”, which is a string and not a number. Due to that, the sorting algorithm treats the entire column as strings and not as numbers, which are simply sorted differently and give you the current results.

    So, the easiest fix would be just remove the ” diameter” from the cell, so that all cells in that column are numbers.
    If that’s not an option, you could install the TablePress Extension from https://tablepress.org/extensions/datatables-sorting-plugins/ and add this to the “Custom Commands” textfield on the “Edit” screen of the table:

    "aoColumnDefs": [ { "sType": "formatted-num", "aTargets": [ 2 ] } ]

    The 2 indicates that the third column should get “special treatment” (counting the columns starts with 0 in the code).

    Regards,
    Tobias

    Thread Starter Monostudio

    (@monostudio)

    Thanks Tobias for such a speedy response – have just downloaded the extension – will have a look later. Tim

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Tim,

    no problem, you are very welcome!
    If this doesn’t help, just let me know!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting numbers to sort correctly’ is closed to new replies.