• Resolved mikeamb

    (@mikeamb)


    Hi all,

    I’m in a bit of a pickle with sorting numbers and need some suggestions. Essentially I have a column for “network port speed” so the cell values are like the following:
    – 10000 Mbps
    – 2000 Mbps
    – 1000 Mbps
    – 100 Mbps

    Currently when the column is sorted descending I want the bigger full value number to show first, 10000 Mbps, however it shows 2000 Mbps as the highest value since presumably it has a 2 in front instead of a 1, despite 10000 being a bigger value than 2000. How can I achieve this to sort the bigger full value? For example when sorting descending it shows:
    – 2000 Mbps
    – 10000 Mbps
    – 1000 Mbps
    – 100 Mbps

    The Mbps text afterwards doesn’t make any difference. I removed it to test and added custom code to sort without it if needed.

    Thanks,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi!

    Thanks for your post and sorry for the trouble!

    You could maybe try using the TablePress Extension from https://tablepress.org/extensions/datatables-sorting-plugins/ here, to add a custom sorting algorithm.

    However, it’s strange that your tests without the “Mbps” text failed here… That indicates that there’s maybe other text in that column? Can you please send me a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Best wishes,
    Tobias

    Thread Starter mikeamb

    (@mikeamb)

    Hi Tobias,

    I tried again removing the text after it and it did work this time and sorting shows 10000 above 2000 now unlike before. Not sure what was wrong, but I think it might have been a caching issue last time. Either way, all works now so this was nothing with the plugin. Thanks for replying!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    great to hear that this helped!

    Just to clarify, did you remove the “Mbps” or was there additional text that you removed?

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Number sorting issue’ is closed to new replies.