WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] numeric sorting (2 posts)

  1. hicksdav
    Member
    Posted 1 year ago #

    My table is located at

    http://riskarbitrageinvesting.com/friendly-merger-deals/

    The problem I am having is when I sort the numeric columns.

    I have one column that lists the "spread" which is a numeric value.

    It appears to only take the first digit into account.

    For example, if the number is 50.56%, it will sort it with the '5's instead of the '50's.

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

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question, and sorry for your trouble.

    Basically you already described the reason for this: The values in the "Spread" column are actually not "numeric" values! They are strings, due to the "%" character in the cells. Due to that, the DataTables JavaScript library recognizes the values in that column as strings, and not as numeric. And strings are sorted differently than numeric values.
    So, to change this behavior, I suggest that you remove the "%" from that column's cells for now. The DataTables JavaScript library does have a way to get percentage values sorted correctly (see http://datatables.net/plug-ins/sorting#percentage ), but I didn't yet have the time to add this to TablePress. I have planned to do that in the next months, though.

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.