Return a number column as a string instead
Return a number column as a string instead
Hi all,
Completely new to DataTables and primarily a ColdFusion developer so I hope I use relevant terminology in this question.
We use DataTables to show large grids of data. On one page we offer an export function. So once we have the result set from DataTables we use that variable to export the data for an Excel spreadsheet.
Because the accessory_number column can be ,"ABC12345", or ,1234567, - sometimes it is coming back from DataTables as a string and sometimes as a number. When we export the data to the Excel spreadsheet this causes data to be displayed aligned-left and some to be aligned-right.
How can I tell DataTables to ALWAYS return the accessory_number column as a string so that it will align-left in the spreadsheet export.
Thanks, Jerry
This question has an accepted answers - jump to answer
Answers
Hi @mallethead ,
This thread should help, it's asking the same thing.
Cheers,
Colin
Thank you Colin. I'm looking over the page you linked to. I should be able to drag a fix out this info.
Appending a \0 character at the beginning of the data fields where the typeof == 'number' upon export solved the problem. There does not appear to be any effect on sorting or observable difference in formatting because of the inclusion of this character.
Jerry