默认情况下添加导出自定义

时间:2017-08-28 11:36:36

标签: javascript datatable datatables

如何默认添加导出按钮及其自定义功能

$.extend($.fn.dataTable.defaults, {
language: {
"loadingRecords": "Loading. Please wait...",
"info": "Showing <span class='startPage'>START</span> to <span class='endPage'>END</span> of <span class='totalPage'>TOTAL</span> entries",
"lengthMenu": "Showing MENU entries"
},
});

1 个答案:

答案 0 :(得分:1)

只需使用buttons字面值扩展:

$.extend( $.fn.dataTable.defaults, {
  buttons: [{ 
     extend: 'pdfHtml5',
     customize: function(doc) {
        doc.defaultStyle.fontSize = 40; 
     }   
   }]  
});

<强> https://jsfiddle.net/t438mzLk/