jquery - Datatables cell contents split into 2 columns on export -
is possible split contents of cell 2 columns upon export?
example of cells contents:
2015-05-29 open shift
open shift
requested output:
2015-05-29 | open shift
is possible datatables?
i'm working on same issue.
you can modify value before exporting using fncellrender : https://www.datatables.net/extensions/tabletools/button_options
i tried add ; between values excel doesn't split cell when open .csv file.
here code tried split date in 3 cells (the date in column 4):
{'sextends':'xls', "oselectoropts": { filter: 'applied', order: 'current' }, "sbuttontext": "csv export", "fncellrender": function ( svalue, icolumn, ntr, idataindex ) { if ( icolumn === 4 ) { var datesplit = svalue.split("."); y = "20"+datesplit[2], m = parseint(datesplit[1]-1), d=parseint(datesplit[0]); return y + ";" + m + ";" + d; } return svalue; } },
hope can help
edit: made worked !!!
change ";" tabulations this: return y + '\t' + m + '\t' + d;
Comments
Post a Comment