2016-12-01 4 views
2

jQueryデータ型のデータに基づいてCSVファイルを書き出しようとしていますが、データの最初の列を除外したいと考えています。私は仕事にそれを得るために追加する必要が何データ型の最初の列を無視するCSV書き出し

<script> 
$(document).ready(function() { 
$('#example').DataTable({ 
    dom: 'Bfrtip', 
    lengthMenu: [ 
     [ 10, 25, 50, -1 ], 
     [ '10 rows', '25 rows', '50 rows', 'Show all' ] 
    ], 
    buttons: [ 
     'copy', 'csv', 'excel', 'pdf', 'print', 'pageLength' 
    ] 
}); 
}); 
</script> 

は、あなたのbuttons定義内exportOptionsを使用する必要が

答えて

4

してください。

buttons: [ 
     { 
      extend: 'pdf',   
      exportOptions: { 
       columns: [1,2,3,4] // indexes of the columns that should be printed, 
      }      // Exclude indexes that you don't want to print. 
     }, 
     { 
      extend: 'csv', 
      exportOptions: { 
       columns: [1,2,3,4] 
      } 

     }, 
     { 
      extend: 'excel', 
      exportOptions: { 
       columns: [1,2,3,4] 
      } 
     }   
    ] 
関連する問題