Update (2016):
Although they fire TableTools for the Button and Select extensions ( source ), this is a slightly newer version of the dom example:
var oTable = $('#my-table').dataTable({ autoWidth: false, autoHeight: false, paging: false, dom: 'TCfrtip', // <-- Update letters for whichever extensions you want to use responsive: false, searching: true, ordering: true, stateSave: true, scrollY: 550, scrollX: true, scrollCollapse: true, fixedHeader: false, buttons: [ 'copyHtml5', 'csvHtml5', 'excelHtml5', 'pdfHtml5' ], columnDefs: [{ targets: 'no-sort', // disable sorting on class="no-sort" orderable: false }], drawCallback: function (settings) { } });
Previous Answer (2013):
The solution is to add this:
"sDom": '<"H"TCfr>t<"F"ip>'
Inside your javascript. It will also work with show / hide columns. If you do not use show / hide columns, you can remove the capital "C".
Example (with show / hide columns):
// Users $("#users-datatable").dataTable({ "bStateSave": true, "bJQueryUI": true, "sPaginationType": "full_numbers", "bProcessing": true, "bServerSide": true, "sAjaxSource": $('#users-datatable').data('source'), "bScrollInfinite": true, "bScrollCollapse": true, "iDisplayLength": 100, "sScrollY": "500px", "sScrollX": "100%", "sDom": '<"H"TCfr>t<"F"ip>', "oTableTools": { "aButtons": [ "copy", "csv", "xls", { "sExtends": "pdf", "sPdfOrientation": "landscape", "sPdfMessage": "Your custom message would go here." }, "print" ] } });
Hope this helps someone.