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

piyushpiyush Posts: 4Questions: 1Answers: 0
edited October 2013 in DataTables 1.9
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

Replies

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    \n means very little in HTML. `
    ` 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
  • piyushpiyush Posts: 4Questions: 1Answers: 0
    Thanks 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
This discussion has been closed.