Html content within column data is getting rendered as string and formatting is not getting applied
Html content within column data is getting rendered as string and formatting is not getting applied
piyush
Posts: 4Questions: 1Answers: 0
Hi,
i have put new line character \n and also some paragraph tags to display formatted content for a column data but when it is getting rendered tags are coming as string and also \n are not getting rendered at all.
Can you please guide how to get column data formatted by putting html tags for column data?
Thanks,
Piyush
i have put new line character \n and also some paragraph tags to display formatted content for a column data but when it is getting rendered tags are coming as string and also \n are not getting rendered at all.
Can you please guide how to get column data formatted by putting html tags for column data?
Thanks,
Piyush
This discussion has been closed.
Replies
` is the equivalent in markup. Beyond that, please link to a test case showing the problem as noted int he forum rules and in the new discussion form.
Allan
Resolved this issue as below.
The issue was coming as column data content was having html tags (
) with encoded values of < and > as < and > respectively.
I used below code to replace < and > with < and > and now column data is getting rendered with new line at the place of
tags.
"aoColumnDefs": [
{
mRender: function ( data, type, row ) {
alert(data);
return data.replace(//g,'>') ;
},
"aTargets": [ 6 ]
}
]
Thanks,
Piyush