2017-11-14 13 views
0

PDFエクスポートを水平に変更したいのですが、例にはPDFエクスポートボタンのみが含まれています。私はCSVとPDFの両方のボタンを持っているので、私はどこに私のCSVボタンを配置するのだろうかと思っています。DataTables CSVエクスポートボタンを使用してPDFを水平方向にエクスポートする

現在のコード:

$('#sales').DataTable({ 
       dom: 'Bfrtip', 
       buttons: [ 
        'csvHtml5', 'pdfHtml5' 
       ], 
       "order": [[ 1, "desc" ]] 
      }); 

が、私はこれを適用したい:ここ

$('#example').DataTable({ 
     dom: 'Bfrtip', 
     buttons: [ 
      { 
       extend: 'pdfHtml5', 
       orientation: 'landscape', 
       pageSize: 'LEGAL' 
      } 
     ] 
    }); 
+1

try [this](https://stackoverflow.com/questions/41805342/datatable-issue-in-pdf-page-size-and-orientation) – hungrykoala

答えて

1

作業溶液からの抜粋(テキストはドイツ語で、どちらか削除するか、あなたの言語に翻訳)。 それは4つのボタンを追加します:enter image description here

dom: 'Blfrtip', 
     buttons: [ 
      { 
       extend: 'colvis', 
       titleAttr: 'Sichtbare Spalten auswählen (gilt auch für Export)', 
       text: '<i class="fa fa-filter" aria-hidden="true"></i>' 
      }, 
      { 
       extend: 'csv', 
       titleAttr: 'Tabelle als CSV exportieren', 
       text: '<i class="fa fa-file-text-o" aria-hidden="true"></i>' 
      }, 
      { 
       extend: 'copyHtml5', 
       titleAttr: 'Tabelle in Zwischenspeicher kopieren', 
       text: '<i class="fa fa-clipboard" aria-hidden="true"></i>', 
       exportOptions: { 
        columns: ':visible' 
       } 
      }, 
      { 
       extend: 'excelHtml5', 
       title: 'Filialübersicht', 
       titleAttr: 'Tabelle als Exceltabelle exportieren', 
       text: '<i class="fa fa-file-excel-o" aria-hidden="true"></i>', 
       exportOptions: { 
        columns: ':visible' 
       } 
      }, 
      { 
       extend: 'pdfHtml5', 
       orientation: 'landscape', 
       title: 'Filialübersicht', 
       titleAttr: 'Tabelle als PDF exportieren', 
       text: '<i class="fa fa-file-pdf-o" aria-hidden="true"></i>', 
       exportOptions: { 
        columns: ':visible' 
       } 
      }, 
      { 
       extend: 'help', 
       titleAttr: 'Hilfe anzeigen', 
       text: '<i class="fa fa-question-circle" style="color:#FF480D;" aria-hidden="true"></i>', 
      } 

最後のボタン(ヘルプ)カスタム1であるが、いくつかのヘルプテキストでモーダルウィンドウを開きます。

関連する問題