Exporting only filtered data using TableTools Button collections

Exporting only filtered data using TableTools Button collections

MySchoolsMySchools Posts: 1Questions: 1Answers: 0
edited June 2014 in TableTools

Hi

When setting up TableTools to group buttons into a hidden drop down list (Button collections) the exported data seems to export all data in the table and not only the filtered visible data. When not grouping the buttons into a collection the export works correctly exporting only the filtered data. Is there a setting that I have missed.

Thanks
Jonathan

<script language="javascript" type="text/javascript">
var selected = [];

$(document).ready(function () {
   var tablePermissionNote = $('#tblClubMembersList').dataTable({
    "dom": '<"toolbar">C<"clear">lfrtip<"clear">T',
            tableTools: {
                "sSwfPath": "http://datatables.net/release-datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
                "aButtons": [{
"sExtends": "collection",
                                 "oSelectorOpts": { filter: 'applied', order: 'current' }, 
                                 "sButtonText": "Export",
                                 "aButtons": ["csv", "xls", "pdf"]
                           }],
     'aaData': dtData,
            'bPaginate': true,
            'bInfo': true,
            'bFilter': true,
            'paging': true,
            'searching': true,
            "bDestroy": true,
            "bSortCellsTop": true,
            "sPaginationType": "full_numbers",
            "sRowSelect": "single",
            "rowCallback": function (row, data, displayIndex) {
                if ($.inArray(data.DT_RowId, selected) !== -1) {
                    $(row).addClass('selected');
                }
            }

});
});
</script>

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Hi Jonathan,

    There is no inheritance in the TableTools buttons in a collection, so the current oSelectorOpts that you have isn't being used at all. You need to define it for each button in the collection I'm afraid.

    A limitation in TableTools that I definitely plan to correct in future!

    Regards,
    Allan

This discussion has been closed.