Support » Plugin: TablePress » Sorting html link text

  • Resolved sedohr7682


    I use 2 or 3 character html link text in one of my cells. The character represent numeric data (price).

    The column will sort on the 1st char of the 2 character ‘value’ and therefore the column does not sort correctly. At first I thought it was because the cell has text and therefore is being sorted as a string rather than a numeric.

    However, I have a similar table running on another site that sorts the same type of data correctly. The only difference is this table has the same # of characters for each ‘price’.

    Does TablePress know a cell contains an html link and therefore sorts based ONLY on the link text? If so, is the data still considered a string for sorting purposes? That’s the only thing I can figure out is happening here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg



    thanks for your post, and sorry for the trouble.

    You are right. The DataTables JavaScript library does recognize that there’s HTML code in the cell, and then just sorts with the link text. However, it treats that as a string and not a number. That leads to to result that you are seeing.
    To fix this, please install and activate the TablePress Extension from
    After that, add this to the “Custom Commands” text field in the “Features of the DataTables JavaScript library” section on the “Edit” screen of the table from :

    "aoColumnDefs": [ { "sType": "num-html", "aTargets": [ 2 ] } ]

    This will fix the data type for the third column of the table (there’s a 2 in the code, because counting starts with 0).


    Perfect! Thanks Tobias…..

    Just FYI… wanted to give a small token of appreciation (in between jobs right now but your plugin/support is AWESOME!)but can’t send gift card w/o and email addy.

    Could not find it anywhere on your donate or amazon wishlist (US) page. ;o(

    Didn’t want to donate via PP and have them remove fees.

    Plugin Author TobiasBg



    great to hear that this solved it 🙂

    And thanks for wanting to donate, I really appreciate it! 🙂
    For that gift card, please send me an email to the address that you can see on I will then send you the email address that I prefer for Amazon (because it is a different one). Thanks!

    Best wishes,

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting html link text’ is closed to new replies.