Title: Numeric Column Sorting Clarification
Last modified: January 12, 2017

---

# Numeric Column Sorting Clarification

 *  Resolved [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/)
 * (@jsnowbusiness)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/)
 * I have a column of numbers that wouldn’t sort properly, I found the command _“
   columnDefs”: [ { “type”: “numeric”, “targets”: 4 } ]_ here in the support threads
   which doesn’t seem to help.
 * My column of numbers does has some asterisks at the end of some of the numbers,
   however those numbers still seem to be sorting fine. The only value not sorting
   properly is the only number over 100.
 * ![Table Pic](https://i0.wp.com/i.imgur.com/AO6hBVQ.png)
 * So my question is.. are the asterisks screwing with sorting? Is my custom command
   wrong? Or is the problem that I need ugly leading-zeroes?
 * Thanks for the help!
    -  This topic was modified 9 years, 5 months ago by [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/).
    -  This topic was modified 9 years, 5 months ago by [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/).
      Reason: clarification

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/#post-8648242)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Yes, this is caused by the `*`. Those are turning the cell data type into “string”,
   and strings are sorted differently.
    If you want to keep those, you could take
   a look at an approach that uses a hidden column with the plain numeric data and
   uses that for the sorting. For details, please see the (very similar) example
   at [https://wordpress.org/support/topic/consolidating-columns-without-changing-sorting-options/](https://wordpress.org/support/topic/consolidating-columns-without-changing-sorting-options/)
 * Regards,
    Tobias
 *  Thread Starter [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/)
 * (@jsnowbusiness)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/#post-8648918)
 * Thank you!
 * So I’ve done what was suggested in that topic (created another column of just
   numerals for sorting) and changed my custom command to this _“columnDefs”: [ {“
   orderData”: [4 ], “targets”: [ 8] }, { “visible”: false, “targets”: [ 8 ] } ]_
   since my visual column is E/#5 and the sort data column is I/#9.
 * This is the result:
 * ![table sort pic2](https://i0.wp.com/i.imgur.com/mzerPno.png)
 * Should I be combining my old custom command with this new addition?
 * Thanks again for all the help.
 * -John Snow
    -  This reply was modified 9 years, 5 months ago by [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/).
    -  This reply was modified 9 years, 5 months ago by [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/).
      Reason: typo in command
 *  Thread Starter [jsnowbusiness](https://wordpress.org/support/users/jsnowbusiness/)
 * (@jsnowbusiness)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/#post-8648973)
 * Nevermind..
 * I see it should be _“columnDefs”: [ { “orderData”: [ 8 ], “targets”: [ 4 ] },{“
   visible”: false, “targets”: [ 8 ] } ]_
 * All is working well now!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/#post-8650086)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Numeric Column Sorting Clarification’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [datatables](https://wordpress.org/support/topic-tag/datatables/)
 * [sorting](https://wordpress.org/support/topic-tag/sorting/)
 * [table](https://wordpress.org/support/topic-tag/table/)

 * 4 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/numeric-column-sorting-clarification/#post-8650086)
 * Status: resolved