Sorting and Searching Problem with Row Containing HTML Tags

Sorting and Searching Problem with Row Containing HTML Tags

progesteroneprogesterone Posts: 1Questions: 0Answers: 0
edited February 2010 in General
Sorting and searching rely on the content between and , and it raises problem if column contains any HTML tags between these two tags.

Eg. Datatable It will also sort and search and which is not desirable in most cases.

HTML tags need to be stripped out in this case. So my fix for the bug is to replace the following in _fnGatherData function.
REPLACE
aLocalData[i] = this.innerHTML;
WITH
aLocalData[i] = this.innerHTML.replace(/<\/?[^>]+(>|$)/g, "");

Replies

  • allanallan Posts: 63,217Questions: 1Answers: 10,415 Site admin
    Hi progesterone,

    Or you can set the sType for the column to 'html' as shown in this example http://datatables.net/examples/advanced_init/html_sort.html :-)

    Regards,
    Allan
This discussion has been closed.