Styling Last Row Excel Export
Styling Last Row Excel Export
I have a small issue with DataTables Buttons Excel Styling, a plugin that worked perfectly with dt1, but not dt2.
The last row of the table refuses to allow styling. I suspect it is because the code believes the last row is a footer, but I have no footer in the table ... just the last row.
Here is link to simple demo.
And here is link to same demo, but with dt1.
I tried setting footer: 'false' in exportOptions, but no effect.
Any suggestions? Should I create an empty last row before exporting?
I've reached out to the author as well.
Thanks, as always in advance.
c
This question has an accepted answers - jump to answer
Answers
That's quite a plugin. I haven't seen it before. I suspect the problem is with this function:
Some debugging of the plugin will need to take place to understand if this is the issue and why it seems to result in one less number of rows. As a workaround / test you could increment the returned result to see if it works, for example:
Kevin
I did a bit of experimentation and it looks like the code assumes there will be a footer even if setting
footer: false
. Some changes were made in DT 2 and the corresponding buttons to support multiple header rows. These changes probably affected the above statement's calculation.Further experimentation shows that the plugin also assumes a single header row. If you have two header rows then it will start formatting in the second header row not the first table row.
I didn't try it but I believe the above change I suggested will provide a workaround for your particular situation but won't fix it for other header and footer configurations.
Kevin
Thank you, Kevin!
Worked like a charm!
Will forward to author as well.
Very much appreciate your follow-up.
c
I don't think I've seen that plugin before either - it is fairly epic!
Allan