How to prevent html escaping in DataTable
How to prevent html escaping in DataTable
zmacomber
Posts: 3Questions: 1Answers: 0
Debugger code (debug.datatables.net):
https://debug.datatables.net/ezazoj
Description of problem:
We get our data from the server side for use in our DataTable. The server is sending back this data for a particular column: S<RP
When the DataTable is rendering that particular column, it renders it as S<RP
I want that column data to display as is as S<RP
How do I accomplish this on a data column?
Answers
Hi,
What you want to do is to actually add HTML escaping - at the moment the HTML characters are being rendered.
Use the
text
helper method to do that.Allan
When I specify my "aoColumns" definition on this column like the following it's still coming back in the wrong format: { "mRender": $.fn.dataTable.render.text() }
If you can link to a page showing the issue I'd be happy to debug it.
Allan
Allan's suggestion works here:
http://live.datatables.net/heyanece/1/edit
Since you are using a legacy form of the options are you using Datatables 1.9?
Can you provide a link to a test case showing the problem?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
It looks like it's a JSP problem rather than Datatables. I have further debugged and found Datatables is rendering the data correct in the JS console on Chrome. I then tested S<RP directly in a table on the JSP and it renders it as S<RP. Thank you all for your guidance.