Format CSV column data before exporting from datatable

Format CSV column data before exporting from datatable

Manya92Manya92 Posts: 10Questions: 2Answers: 0
edited January 2020 in Free community support

I exported a CSV file but one column which has a hyperlink to add data also gets exported as text. Now I want to remove the text which is appended at last of each row in that particular column. So I tried format in export options. So now all datas are exported with their html tags and that hyperlink text also was not removed and getting exported as html data instead of text.
How to prevent this ?

exportOptions: {
columns: [0,1,2,3,4,6,7,8,9,10,11,12],
format: {
body: function ( data, row, column, node ) {
return data.replace("add","");
} }
}

csv data getting exported

<span ng-class="{'color-gray': !row.labels||row.labels.length==0}" class="ng-binding">JIRA_CREATED, united_states</span>

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    You could try the option stripHtml - see here.

    If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.