tabletools' bSelectedOnly doesn't seem to work in exporting only visible rows

tabletools' bSelectedOnly doesn't seem to work in exporting only visible rows

jeromedtjeromedt Posts: 6Questions: 1Answers: 0

Hi all,
Hopefully someone can help me with my issue.
I have a fairly large table with ~ 1000 rows. I have created a system of rules that the user can apply to only show a subset of those rows.
I use jQuery's hide()/show() function to make the rows invisible/visible.
Once the user is happy with the rows that are visible on the screen, he wants to export (using TableTools) those visible rows (and not the invisible ones).

I have tried using bSelectedOnly but all rows are being exported.
Here's the way I use TableTools:

 options['oTableTools'] = {
       "sSwfPath": "../TableTools-2.2.3/swf/copy_csv_xls_pdf.swf",
       "aButtons": [
           {"sExtends": "copy", "bSelectedOnly": true}, "csv", "xls", "pdf"]
    };
    dt.dataTable(options);

mColumns seems to be exactly what I want but mColumns is for columns and I need rows... :-(

Please help.

Thanks.

Answers

  • jeromedtjeromedt Posts: 6Questions: 1Answers: 0

    After much searching and looking that the code, I found a solution to my problem by using oSelectorOpts: 'tr:visible' as follows:

    options['oTableTools'] = {
          "sSwfPath": "../TableTools-2.2.3/swf/copy_csv_xls_pdf.swf",
          "aButtons": [
              {sExtends: "copy", oSelectorOpts: 'tr:visible'}, 
              "csv", "xls", "pdf"]
       };
       dt.dataTable(options);
    

    Hopefully that will be helpful to someone else.

This discussion has been closed.