I need to make datatable cell "email" as a active link mailto: ...
So, i made something like this:
{ data: 'email',
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a href='mailto:"+oData.email+"'>"+oData.email+"</a>");
}
}
This is working, but when the row does not have email, then it will print out as "mailto:null", so I need something like IF statement to check if there is data in that cell. If there is no data then the cell will be left empty.
So, i tried something like below and its not working.
{ data: 'email',
"fnCreatedCell": if ($('"+oData.email+"').val() != '') { function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a href='mailto:"+oData.email+"'>"+oData.email+"</a>");
}}
},
How to fix that code?
Regards.