Data Table with export option should export only s

2019-09-11 14:11发布

问题:

Friends I'm using data table with export option but my requirement is . I have to download with search option . For example if I filter through position only those portion has to be downloaded . Where as now if I use the filter in table and give the export It is exporting whole value . I have attached The another image which I've to download only those values and not the whole value( Search filter enabled with position as Software Engineer) . So I will download only the data with position as software engineer.

回答1:

Here is a generic example. It will show the PDF button and export only filtered rows :

$('#example').DataTable( {
  dom: 'Bfrtip',
  buttons: [{
    extend: 'pdfHtml5',
    exportOptions : {
      rows : {search:'applied'}
    }
  }]
});