I have a requirement to safely output html and script, which I've learned I should use $.fn.dataTable.render.text() to achieve. Trouble is, I'm currently using render: function(data, type, row) and within that function I have some logic to decide what value to output. In most cases I'm simply rendering 'data' but in one case I'm rendering a different field in the row object.
How can I achieve safe rendering of html and script in this case? Here is my current function:
render: function(data, type, row){
if(row.Type__c === 'Chat'){
return row.Live_Chat_Transcript__r.Body;
}else{
return data;
}
}