Select columns before export besides of the visible columns
Select columns before export besides of the visible columns
JLLB
Posts: 2Questions: 1Answers: 0
Hi,
I would like to know if it´s possible in any export button show a modal window like the 'colvis' option,
But in this case should be to select which columns to export besides the columns that are visible.
This is a sample of the object:
var assetLocDataTable = $('#tableAssetLocations').DataTable( {
"pageLength": 100,
"stateSave": true,
"stateDuration": 0,
"scrollY": "800px",
"scrollCollapse": true,
"sScrollX": "100%",
"sScrollXInner": "100%",
"aoColumnDefs": [
{ "sWidth": "70px", "aTargets": '_all' }
],
colReorder: true,
dom: 'Bfrtip',
buttons: [
{extend: 'csv',text: 'Export To CSV',exportOptions: {columns: 'visible'}},
{extend: 'copy',text: 'Copy To Clipboard',exportOptions: {columns: ':visible'}},
{extend: 'colvis',postfixButtons: [ 'colvisRestore' ],collectionLayout: 'four-column'},
],
} );
Thanks!
This discussion has been closed.
Answers
Here are some examples of column selectors:
https://datatables.net/extensions/buttons/examples/html5/columns.html
Kevin
Thanks Kevin for answering!
I saw that samples, but what I´m asking for is to make a window like the one that appears when you press 'Column Visibility' but for the export buttons.
So you press the 'CSV' button, and a window appear to choose which columns you want to export besides what you selected with the 'Column Visibility' button.
Thanks a lot!
Jau
There isn't an option for that at the moment. You'd need to create a custom button that provides that ability if you need that.
Allan