TableTools copying all rows not just filtered

TableTools copying all rows not just filtered

bsawyerbsawyer Posts: 2Questions: 0Answers: 0
edited February 2014 in TableTools
I am trying to setup the datatable so when I filter the data using the search box I can copy the filtered results. The table will filter as it is supposed to but when I copy or save it copies all rows including those that don't match the filter.

Any guidance would be appreciated.


This is my initiation code.


[code]
$('#procedure_list').dataTable({
"bLengthChange": true,
"iDisplayLength": 10,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "assets/plugins/data-tables/extras/tabletools/swf/copy_csv_xls.swf",
"aButtons": [ "copy", "csv" ]
},
"aoColumnDefs": [
{ "sType": "string", "aTargets": [ 0 ] }
],
"aaSorting": [[ 0, "desc" ]]
});
[/code]

Replies

  • banditobandito Posts: 2Questions: 0Answers: 0
    same problem
  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    You can use the oSelectorOpts ( http://datatables.net/extras/tabletools/button_options#oSelectorOpts ) option to tell TableTools to export only filtered rows, the current page, etc.

    Allan
  • bsawyerbsawyer Posts: 2Questions: 0Answers: 0
    Thanks Allan. That worked great.
  • hermes980hermes980 Posts: 41Questions: 13Answers: 0

    It doesn't seem to be an option in the latest version. How can I only export filtered rows?

  • fabianopallfabianopall Posts: 7Questions: 1Answers: 0

    I agree.. any other side solution? I am just try to find a way to do it.. no luck yet

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Ooops - it is there in the code, just not in the documentation... I'll correct that just now, but for the moment, use the legacy documentation: http://legacy.datatables.net/extras/tabletools/button_options#oSelectorOpts .

    Allan

  • mttgnemttgne Posts: 4Questions: 1Answers: 0

    Using oSelectorOpts does not work for me. Still esporting all rows

  • RevoltRevolt Posts: 2Questions: 1Answers: 0

    Doesn't work for me either when exporting to pdf. For clipboard, csv and xls export it works. I'm using this configuration:

    var tableToolsButtonsOptions = {
        bSelectedOnly: true,
        oSelectorOpts: {
            filter: "applied"
        }
    }, tableTools: {
        aButtons: [$.extend({
                sExtends: "copy",
                sButtonText: "Copy to clipboard"
            }, tableToolsButtonsOptions), {
                sExtends: "collection",
                sButtonText: "Export",
                aButtons: [
                    $.extend({
                        sExtends: "csv"
                    }, tableToolsButtonsOptions),
                    $.extend({
                        sExtends: "xls"
                    }, tableToolsButtonsOptions),
                    $.extend({
                        sExtends: "pdf",
                        sPdfOrientation: "landscape",
                        sPdfSize: "A3"
                    }, tableToolsButtonsOptions)
                ]
            }
        ]
    }
    
  • csgjbeckcsgjbeck Posts: 8Questions: 2Answers: 1
    edited June 2014

    Here are the oSelectorOpts possible options:

    http://datatables.net/docs/DataTables/1.9.4/#$

This discussion has been closed.