WordPress.org

Ready to get started?Download WordPress

Forums

WP-Table Reloaded
[resolved] Sorting numbers (4 posts)

  1. footballperspective
    Member
    Posted 1 year ago #

    Having some trouble with sorting in one of my tables.

    http://www.footballperspective.com/larry-fitzgerald-innocent-bystander/

    In the third/final table on that page, if you sort by the Yards column, it doesn't sort numerically but alphabetically. Ditto the N+1 Rk column. Basically it's putting 1100 as lower than 200, and 300 as lower than 90.

    Any thoughts?

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

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question.

    The problem here are the "--" entries in that column. Due to those, the JavaScript library that performs the sorting thinks that the column contains strings, and not numbers. And strings are sorted differently than numbers, and this leads to the behavior that you currently experience.
    If just change the "--" entries to be empty, the sorting should work as expected on that column.

    Regards,
    Tobias

  3. footballperspective
    Member
    Posted 1 year ago #

    That makes a lot of sense and it works perfectly now. Thanks to much Tobias!

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    awesome! Great to hear that! :-)
    Always nice, when fixes are so easy!

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.