[resolved] numeric sorting (2 posts)

  1. hicksdav
    Posted 3 years ago #

    My table is located at


    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.


  2. TobiasBg
    Plugin Author

    Posted 3 years ago #


    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.