WordPress.org

Forums

WP-Table Reloaded
[resolved] Sorting doesn't work properly (8 posts)

  1. aktive
    Member
    Posted 2 years ago #

    Sorting doesn't work properly when there are non-numerals in the numbers (e.g. "$836,000" or "$903" or "1,184"). The sorting order ends up not correct when you try to sort them (e.g. $1,000 is sorted as smaller than $4,63). How do I fix this?

    Please see an example here: http://propertymarketinsights.com/test-2/

    http://wordpress.org/extend/plugins/wp-table-reloaded/

  2. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    your observation is totally correct, and the reason is simple: Currencies are initially detected as "text" and text and numbers are sorted differently.

    To have that column sort correctly, some extra JavaScript code is necessary. Please take a look at this thread for more information:
    http://wordpress.org/support/topic/wp-table-reloaded-sorting-doesnt-work-properly-in-ie

    Regards,
    Tobias

  3. aktive
    Member
    Posted 2 years ago #

    Hi Tobias, thanks so much for your reply! So to fix the problem I just have to upload the currency sorting plugin to wordpress and activate it? Sorry for the basic question - I'm not very technical.

    WP-Table Reloaded is an awesome plugin BTW - I've made a small donation as thanks for your great work.

    Thanks, Andrew

  4. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Andrew,

    thanks for your donatin, I really appreciate it!

    Yes, uploading that plugin and activating it should be sufficient. If everything goes right, this will hook into WP-Table Reloaded and the currency sorting functions.

    Regards,
    Tobias

  5. tangobango
    Member
    Posted 2 years ago #

    Hi Tobias. Great plugin, as you know.

    I have installed the currency sorting extension, but my columns still aren't sorting correctly. I saw in some previous posts you said to add some code like

    "aoColumnDefs": [ { "sType": "currency_sorting", "aTargets": [ "column-8" ] }

    Is that still necessary? And how do I adapt the parameters for different tables?

    Many thanks. Ed

  6. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Ed,

    yes, you will need to install that currency sorting Extension (and don't forget to activate it!).
    Then, each table that has currency values needs a command like you posted, in the "Custom Commands" textfield in the "DataTables JavaScript Features" section on the table's "Edit" screen.
    The part like "column-8" defines which column has the currencies. Just adjust that properly. For several currency columns in one table, you would use "column-2", "column-3", "column-7" with the correct column numbers.

    If you still can't get it to work, please post the URL of the page/post with the table that you are trying this on.

    Regards,
    Tobias

  7. tangobango
    Member
    Posted 2 years ago #

    Tobias: Thanks for the fast response. All is now working great.

    Now I see how to set the right columns and I added the closing "]" which I had missed and I'm set.

    Thanks for all your work on this.

    I'm off to donate right now.

    Ed

  8. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Ed,

    great that this works now :-)

    Yes, the code needs to be exact, with all []{} characters, as the JS otherwise breaks.

    And thanks for wanting to donate, I really appreciate it!

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Table Reloaded
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic