• Resolved whoaloic

    (@whoaloic)


    Hello Tobias,
    I notice that the plugin does not sort correctly negative values.
    By example, I have 3 cells with “-1″,”-11″,”-3″ and when I sort the cells in descending order, it gives me that sorting : “-3”, “-11”, “-1” and it should be “-1”, “-3”, “-11”.

    Same problem with negative and decimal values.

    Please do you have a solution?

    https://www.ads-software.com/extend/plugins/wp-table-reloaded/

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

    (@tobiasbg)

    Hi,

    that’s probably happening because the sorting algorithm from the DataTables JavaScript library (which does the sorting), detects the cell contents as strings and not as plain numbers. And as strings are sorted differently, you get these results.

    Can you post the URL to the page with your table? I can then try to find out what’s causing this in your case.

    Regards,
    Tobias

    Thread Starter whoaloic

    (@whoaloic)

    Hi,
    Therefore, is there a way to sort number ?
    here’s the URL!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for the link.

    The reason in your case is that you are using commas (,) in your numbers. I know that this is the common character to use in France (and here in Germany, too), but unfortunately, the DataTables library is developed in Great Britain (see https://www.datatables.net), where a period (.) is used as a decimal delimiter.

    Therefore, I suggest that you replace all , with . in your cells. Another idea could be to install this plugin extension: https://tobias.baethge.com/download/plugins/additional/wp-table-reloaded-commavalues.zip

    Regards,
    Tobias

    Thread Starter whoaloic

    (@whoaloic)

    Thank you for you answer,
    OK for using a period instead of a comma.

    Regarding the plugin extension (I install it as a usual plugin), it does not change anything if I keep commas.

    Regards

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    if using a period works for you, that’s great!

    The plugin extension is rather old already, so it might not work anymore. I’ll have to take a deeper look once I find the time. And it might be that it actually had a different purpose (namely allowing commas a thousand separators), I don’t really remember at the moment…

    Best wishes,
    Tobias

    Thread Starter whoaloic

    (@whoaloic)

    Thank you for taking time to answer Tobias,
    regards.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Does not sort correctly negative values’ is closed to new replies.