Sorting and Searching Problem with Row Containing HTML Tags
Sorting and Searching Problem with Row Containing HTML Tags
progesterone
Posts: 1Questions: 0Answers: 0
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, "");
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, "");
This discussion has been closed.
Replies
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