Filtered data exported with table tools.

Filtered data exported with table tools.

pricejtpricejt Posts: 12Questions: 5Answers: 1
edited February 2015 in TableTools

I have seen this question asked a few times and all the answers say to use oSelectorOpts. I believe i am doing this however it doesn't appear to be working .

$(document).ready(function() {
            var oTable = $('#SensorData').DataTable(
            {
                "order": [[2, "desc"]],
                dom: 'T<"clear">lfrtip',
                tableTools: {
                    "sSwfPath": "assets/swf/copy_csv_xls_pdf.swf"
                },
                "oTableTools": {
                    "aButtons": [
                        {
                            'sExtends': 'copy',
                            "oSelectorOpts": { filter: 'applied', order: 'current', page: 'all' },
                        },
                        {
                            'sExtends': 'xls',
                            "oSelectorOpts": { filter: 'applied', order: 'current' },
                        },
                        {
                            'sExtends': 'print',
                            "oSelectorOpts": { filter: 'applied', order: 'current' },
                        },
                        {
                            'sExtends': 'pdf',
                            "oSelectorOpts": { filter: 'applied', order: 'current' },
                        },
                        {
                            'sExtends': 'csv',
                            "oSelectorOpts": { filter: 'applied', order: 'current' },
                        }
                    ]
                },
                "columnDefs": [
                    {
                        "targets": [0],
                        "visible": false,
                        "searchable": false
                    }
                ]
            });

Answers

  • pricejtpricejt Posts: 12Questions: 5Answers: 1

    Finally figured this out.
    Updated code

    var oTable = $('#SensorData').DataTable(
                {
                    "bServerSide": false,
                    "order": [[2, "desc"]],
                    dom: 'T<"clear">lfrtip',
                    tableTools: {
                        "sSwfPath": "assets/swf/copy_csv_xls_pdf.swf",
                        "aButtons": [
                            {
                                "sExtends": "copy",
                                "mColumns": [1, 2],
                                "oSelectorOpts": { filter: "applied", order: "current" }
                            },
                            {
                                'sExtends': 'xls',
                                "mColumns": [1, 2],
                                "oSelectorOpts": { filter: 'applied', order: 'current' }
                            },
                            {
                                'sExtends': 'print',
                                "mColumns": [1, 2],
                                "oSelectorOpts": { filter: 'applied', order: 'current' }
                            },
                            {
                                'sExtends': 'pdf',
                                "mColumns": [1, 2],
                                "oSelectorOpts": { filter: 'applied', order: 'current' }
                            },
                            {
                                'sExtends': 'csv',
                                "mColumns": [1, 2],
                                "oSelectorOpts": { filter: 'applied', order: 'current' }
                            }
                        ]
                    },
                    "columnDefs": [
                        {
                            "targets": [0],
                            "visible": false,
                            "searchable": false
                        }
                    ]
                });
    
This discussion has been closed.