Export CSV - Can't change footer value when value are modify using exportOptions
Export CSV - Can't change footer value when value are modify using exportOptions
With the DataTables.js v3.0.0, when I try to modifiy avec value in the footer, my value in not taken in account. In the CSV file, I always found then value which is in the table and not the returned value
I don't have this problem with the body
I tried with an older version (1.5.1), this problem does not exist
exportOptions: {
//footer : true,
format: {
body: function (data, row, column, node) {
return remove_char_not_numeric(data, node)
},
footer: function (data, row, column, node) {
return remove_char_not_numeric(data, column);
},
Answers
The issue was posted in this thread. You should find the fix in the datatables and buttons nightly downloads. I think the fixes will find their way into the next releases of datatables and buttons.
Kevin
I actually noticed the same problems as those reported in the commits. I applied all these fixes because my library is installed locally (I downloaded the files from the DataTables.net site)
The problem I see is the following:
In cell th of my header or footer I have for example the value 1234.
In export options I return "TEST" + data
Unfortunately in the CSV I find 1234 and not TEST 1234
To temporarily fix this problem I modified the header and footer code locally here :
In datatables.js line 102745
for my use case it's enough
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
Small clarification, if I use version 1.5.1 of datatables I do not notice this problem
When the same code in exportOptions I see TEST 1234 in the CSV without modifcation in the library
I built a test case for you using all nightly code:
https://live.datatables.net/fuyiyaxu/1/edit
The header nor the footer are modified with the exportOptions format function. @allan will need to take a look.
Kevin
Your example reflects exactly the problem I see
Thanks a lot
Could you post a link to your page showing the issue so I can trace it through please?
The version numbers mentioned are a bit mixed up - there is no DataTables 3 for example, and 1.5.1 is ancient (2009), so I'd like to check what it is that you are actually using.
Many thanks,
Allan
You may have missed it but I posted a test case showing the issue.
Kevin
Also this thread is reporting the same issue.
Kevin
Yup - bit of post overlap there, sorry about that. Thanks for the test case Kevin - I can indeed see the issue there. Wonder how I've broken it this time...
Will be back shortly once I've fixed it.
Allan
Fixed here and the example with the nightly is now working as expected.
I wasn't passing the header and footer titles from the new multi-row header and footer functions through the formatters. It happens now though.
Thanks for the test case Kevin - is makes this so much easier. Thank you!
Allan
But this update is not yet released, correct?
That is correct. I've not yet tagged a release version with the fix.
Allan
See latest release is out and this issue seems resolved.
Thank you!
It works with me now. Thank you again!