WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Sorting not working with negative values/large currencies (4 posts)

  1. sherrie.gonzalez
    Member
    Posted 1 year ago #

    Hi,

    I'm trying out your plugin for the first time this week and I have to say, it's really great. The only issue I'm having is with the sorting. (I did install the sorting extension, btw) I set up a chart that has values for change in price on homes so there's negative values of percentages that are sorting incorrectly because they're basically just looking at the first number. Also, large values with currency are not sorting properly either. I did a test and I either had to take out the comma or the dollar sign to get the numbers to sort correctly. We also have some entries that are 'N/A' and they rank to the top in the sorting because it doesn't know how to interpet the string. /: I might be able to fix those by using js to give them a value of 0. If you have any suggestions, I would appreciate them! And I'm sorry if this has been addressed but I spent quite some time going through the forums along with searching google and still came up short. Thanks!

    http://wordpress.org/extend/plugins/tablepress/

  2. sherrie.gonzalez
    Member
    Posted 1 year ago #

    Oh, it's actually not working with commas at all I just realized for the larger values. /:

  3. sherrie.gonzalez
    Member
    Posted 1 year ago #

    Actually fixed it! Thanks!

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Sherrie,

    thanks for your post, and sorry for the trouble.

    Yes, the sorting by default (as it comes from the external DataTables JavaScript library from http://www.datatables.net) only has basic number types for sorting.
    Things like percentages or currency values require more attention. The Sorting Plugins Extension is usually quite good at that, but sometimes the automatic detection of the sort type still fails. It is then usually possible to manually set that sort type though.
    Columns with text, like "N/A" are however critical. As these are not numbers, the script just doesn't know how to treat them, so that avoing such entries is in general recommended.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic