Datatable export to csv and excel not exporting correct data.
Datatable export to csv and excel not exporting correct data.
khadayat
Posts: 2Questions: 0Answers: 0
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (oData.ResponseType == 1) {
$(nTd).text("Type 1");
}
else if (oData.ResponseType == 2) {
$(nTd).text("Type 2");
}
else if (oData.ResponseType == 3) {
$(nTd).text("Type 3");
}
}
Above code replaces the id 1,2 and 3 (from database) with the text and works fine. But when I export the datatable it exports 1,2 and 3 instead of the text Type1, Type2 and Type3. Can anyone please help fix this issue. Thanks,
This discussion has been closed.
Replies
Use a renderer rather than
columns.createdCell
to modify the text shown in the cell.Thanks,
Allan
Thank you Allan, it worked.