问题
I am using datatables with tabletools on a large table which is filled via ajax request.
When user selects several rows, it shows them as selected in the table.
How can i tell the csv/xls export to ONLY export the selected rows?
Thanks in advance
回答1:
Stupid me...
Just got it:
{
"sExtends": "csv",
"bSelectedOnly": true
}
回答2:
If for somebody like me bSelectedOnly
is not working
(e.g always all rows are copied when only certain selected), before you burn into cry, just check if your run 2.2.3
version of dataTables.tableTools.js
becuase there was bug corrected in this release: https://github.com/DataTables/TableTools/commit/a9afb46cb00417db6d0fd6d7697e5d28830bc959
Fix #48: `bSelectedOnly` option was not working in 1.10.
* Fix is to use the new `fnGetSelectedIndexes` which gives the
information required for `bSelectedOnly` when needed.
来源:https://stackoverflow.com/questions/13498489/datatables-tabletools-export-only-selected-rows