Using DataTables 1.10.5 - Cannot filter exported data
Using DataTables 1.10.5 - Cannot filter exported data
I am new to DataTables, and am using the DataTables script within an XML Stylesheet. I only mention this part since I have to be more careful with syntax to be sure tags are correctly ended. I also am not able to use the dom options that include tags such as below as this gives syntax errors when I publish my website.
"dom": '<"toolbar">C<"clear">lfrtip<"clear">T',
I have everything working except that when I click on a button to export (clipboard, CSV or PDF), all rows within the table are exported and not just the filtered rows.
I have tried several different attempts at using oSelectorOpts but cannot get it to take effect.
This is my script:
var table = $('#mytable').DataTable( {
dom: 'TCRlfrtip',
stateSave: true,
tableTools: {
"sSwfPath": "DataTables-1.10.5/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"oTableTools": {
"oSelectorOpts": { "filter": "applied" },
"aButtons": [
{
"sExtends": "copy",
"sButtonText": "Copy to clipboard",
}
]
}
},
colVis: {
exclude: [],
groups: [
{
title: "Group1",
columns: [ 0, 1, 2, 3, 4, 5]
},
{
title: "Group2",
columns: [ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ]
}
]
}
} );
Please can somebody help?
Thanks,
Mark T
This question has an accepted answers - jump to answer
Answers
Is this a new issue in 1.10.5? The title of the post appears to suggest it might be?
It looks like the issue is that your
oSelectorOpts
hasn't actually been applied to the button. You need to put it in the button definition.Allan
Hi Allan, I have tried your suggestion but still see the full number of rows copied to clipboard instead of the filtered number.
Can you link to the page so I can debug it then please.
Allan
I sent you a PM with the web page and user credentials.
Thanks Allan.
Thanks for the link. IN your DataTables configuration you have:
It should be:
i.e. don't have
oTableTools
as a property oftableTools
. That isn't a property that TableTools looks for.Allan
Perfect - that worked. Thank you Allan