Fixed Columns and TableTools

Fixed Columns and TableTools

ober0330ober0330 Posts: 5Questions: 0Answers: 0
edited March 2013 in DataTables 1.9
First of all, Datatables is AWESOME! :-)

Now the problem. I'm using DataTables 1.9.4, FixedColumns 2.0.3, and as far as I know the latest version of TableTools. I have a table with 2 rows in the element of the table and the display of the table works great. However, I need to be able to use the TableTools Excel/CSV functionality to get all the data plus both header rows out. The default TableTools doesn't pull both rows so I found this hack:

http://stackoverflow.com/questions/7660683/tabletools-only-exporting-single-header-row

At first it wasn't working but then I disabled the FixedColumn stuff and BAM, works like a dream with the hack in place now.

So now I'm faced with a table that doesn't have fixed columns or a table that doesn't export all the header rows. Is there any way to resolve this? Obviously it's a conflict between TableTools and FixedColumns, but I don't know where to begin fixing it.

The application is behind security so I can't link to it. Here is my header definition with the fixed header stuff commented out:

[code]










<!---->




.ellip {
max-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.page {
margin-top: 50px;
}

.sorting,
.sorting_desc,
.sorting_asc {
background: none !important;
}




$(function() {

var oTable = $('#dtable').dataTable({
"sScrollX": "100%",
//"sScrollXInner": "150%",
"bScrollCollapse": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"aaSorting": [[2,'asc'], [3,'asc']],
"bStateSave": false,
"oLanguage": {
"sSearch": "Search all columns:",
"sLengthMenu": 'Display '+
'20'+
'30'+
'40'+
'50'+
'100'+
'All'+
' records'
},
"aoColumnDefs": [
{ "sClass": "right", "aTargets": [ 10,11,12,13,14,15,16,17,18,19,20,21,22 ] },
{ "sType": "formatted-num", "aTargets": [ 10,11,12,13,14,15,16,17,18,19,20,21,22 ] }
],
"iDisplayLength": 20,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "<?=$env?>js/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
}

});

/*new FixedColumns( oTable, {
"iLeftColumns": 1
});*/


});


[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    TableTools specifically only exports one row in the header. You'd need to modify TableTools if you want anything else. This was done to avoid issues with colspan / rowspan which obviously cannot be represented in CSV.

    Allan
  • ober0330ober0330 Posts: 5Questions: 0Answers: 0
    Hi Allan! Thanks for the response. I understand the inability to support rowspan/column span issues in CSV. I'm not using those features in this case. I simply have a titles row and a totals row and they both needed to be stuck at the top. Maybe there is a different way to do a totals row that I could use instead? Keeping in mind that it's not a straight summation for some of them. I would need to specify the values in the totals.

    This still doesn't address the issue that the Frozen Column modification seems to be causing an issue when I can get TableTools to spit out both header rows.
This discussion has been closed.