Open ghost opened 11 years ago
I'm getting the same behavior. Apparently bug is caused by fnCalcColRatios function, which calculates invisible column width as 0:
iWidth = aoCols[i].nTh.offsetWidth;
Not sure what the good fix would be though, to get proper width we need to render the column, i.e. make it visible.
Hmmm - tricky one. Note sure what the correct thing to do is either. Possibly calculate the widths based on the content of the headers (strlen
)... What I really would like is for the PDF generator to figure it out, but it doesn't seem to work that way.
Any update on this?
Sorry no. I've not had time to work on it yet.
A hack, super easy, super fast, "at least it looks better than terrible" workaround until someone figures out something better:
iWidth = aoCols[i].nTh.offsetWidth;
if (!iWidth && typeof iDTTTDefaultHiddenColumnWidth !== 'undefined') {
iWidth = iDTTTDefaultHiddenColumnWidth;
}
then we set the variable in the global scope to have a reasonable default (we have one table per page, we tune to that specific table). Even simpler could be iWidth = aoCols[i].nTh.offsetWidth || 200;
.
I know, I know, it's hideous and horrible, I'm not suggesting this as a change to the mainline. It has the advantage of getting us up and running again without rolling our own PDF generator, I figured I'd pass it along to other desperate coders. :-)
I found a bug where a column with property
"bVisible":false
is not properly exported to PDF. I have written a sample HTML page, see https://gist.github.com/4599023. Unfortunately you have to run the HTML page from a local webserver because of Flash security restrictions. (It seams the .swf must be served from the same webserver as the HTML file, opening the file with the browser wan't work. I also wrote a jsFiddle with the same problem, perhaps because of the iframe).The example contains a table with 4 columns, the 3rd column is hidden with
"bVisible":false
. I would like export all 4 columns, TableTools has been configured with:The exported PDF has the 4th column merged into the 3rd.