Export only visible rows with csv/pdf/print buttons?
Export only visible rows with csv/pdf/print buttons?
Sansui
Posts: 7Questions: 2Answers: 1
There seems to be some old information on the old TableTools for limiting exports to visible or selected rows, but I'm having a hard time finding the same kind of info for the new buttons. I see there is a plugin for limiting by column visibility, but what about rows? With a couple thousand rows I really only want the filtered set to show up in an export.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
On another thread I found this snippet about using the row selector with exportOptions. Instead of selected:true, could I set it to a jquery selector somehow?
Found what seems to work. It doesn't export visible like I was thinking, but the actual filtered set, which is better.
"buttons": [
{ extend: 'csv', text: 'CSV', exportOptions: { modifier: { search: 'applied' }}},
{ extend: 'excel', text: 'Excel', exportOptions: { modifier: { search: 'applied' }}},
{ extend: 'pdf', text: 'PDF', exportOptions: { modifier: { search: 'applied' }}},
{ extend: 'print', text: 'Print visible', exportOptions: { modifier: { search: 'applied' }}}
]