sType html

sType html

jriverajrivera Posts: 14Questions: 0Answers: 0
edited January 2010 in General
Hi, I was specifying sorts on columns with sTypes of numeric, ip-address and currency. The plugins for ip and currency worked fine.
Later, I had to wrap the data in HTML and the sorts don't work correctly. If I change the sType to html, the sort still won't sort correctly because the default behavior is to sort like a string (and not numeric, ip, or currency).
Is there a way to specify that the column should be stripped of HTML and then sorted by the sType?
Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There isn't a built in way to do this - since sType directly effects both sorting and filtering. What you can do through is to do a custom sorting plug-in, which you've seen, but also custom filtering plug-ins: http://datatables.net/development/filtering . IN this way you can create your own sType which will do exactly what you want with both filtering and sorting.

    Regards,
    Allan
  • Christian BonatoChristian Bonato Posts: 18Questions: 0Answers: 0
    A quick and dirty way to do it is to add at the beginning of each row of a sortable column, a :

    [code]
    formatted_searchable_stringDisplayed String
    [/code]

    Christian
This discussion has been closed.