customizeData
customizeData
RagnarGrootKoerkamp
Posts: 48Questions: 14Answers: 1
Currently, only the excel export has a customizeData option to modify the raw data object before the document is generated. It would be nice to have a similar function for the copy and csv exports.
In my case, I have a table where some cells contain nested DataTables, and I would like to create something like
col | col a | col b
-------------------------
v | v1a | v1b
| v2a | v2b
where the v[12][ab] values are a nested table in the first row. Would there be an easy way to achieve this without implementing customizeData mysql?
(I don't bother implementing customizeData. I'm just curious why it isn't there yet.)
I kind of expected this to be a member of exportOptions, so that all export types can use the same callback. Also, in the excel export, customizeData is directly called on the output of buttons.exportData(), so moving it inside that function seems more logical to me.
This question has an accepted answers - jump to answer
Answers
The
customizeDataoption is a bit of a legacy hack. It was put in place before the Excel export buttons had acustomizecallback and it was the only way to modify the output data.I'm not sure this would be easy even with
customizeData. How would you represent a nested table in CSV for example?Allan
I decided to implement the
customDatacallback, and now, it returns something like:which suits my purposes just fine.