Is it possible to exclude the first 3 coloums when exporting to pdf, csv, excel

Is it possible to exclude the first 3 coloums when exporting to pdf, csv, excel

NikkeNikke Posts: 8Questions: 0Answers: 0
edited April 2011 in General
I have a generic datatable structure that I use on 5 diff pages. All these tables do have a generic 3 columns with graphical icons, these are non sortable columns.

[code]
$('#myTable1').dataTable( {
// 1st 3 columns will not be sorted
"aoColumnDefs": [{ "bSortable": false, "aTargets": [ 0,1,2 ] }],
//......

"aButtons": [
"print",
{
"sExtends": "collection",
"sButtonText": "Save",
"aButtons": [ "csv", "xls", "pdf" ]
}
]

[/code]

When I "Save" any of my tables I would like to exclude the 1st 3 columns. Is it possible to do this? Please point me to the right direction, I looked into the documentations and I don't think there is a straight forward way to do this. Or I am not looking at the right place? :)

Thanks a bunch!

Nikke

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    mColumns is the parameter needed for this: http://datatables.net/extras/tabletools/button_options#mColumns .

    Allan
  • NikkeNikke Posts: 8Questions: 0Answers: 0
    Thanks again Allan for your help! I shall read about it. If I may make a suggestion....

    I notice you have 'all', 'visible' or 'hidden' are the available parameters, I think it would be beneficial to have a 'sortable' column along with the existing 3.

    Specially for something like what I am after (which re-uses the same datatable scripts) but with varying column lengths. The only part that is common is the 1st 3 columns are un sortable everything else is... :)

    Just a suggestion! Thanks a bunch for your!

    Nikke
  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Sounds like a good idea to me - I've just committed this into TableTools and it will be included in the next release :-). You can grab the new version from the 'nightly' option on the DataTables downloads page: http://datatables.net/download .

    Allan
This discussion has been closed.