【发布时间】:2021-11-11 06:29:27
【问题描述】:
我正在尝试在 datatble pdf 导出中添加页码,在添加此代码 pdf 按钮消失并得到“未捕获的 ReferenceError: doc is not defined”后,我从其官方网站获取了代码 在 HTMLDocument' 控制台中出现错误。
$('#table2').DataTable({
dom: 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'Data export',
filename: 'dt_custom_pdf',
pageSize: 'A4',
exportOptions: {
columns: ':visible',
search: 'applied',
order: 'applied'
},
},
doc['footer']=(function(page, pages) {
return {
columns: [
'Left part of footer',
{
alignment: 'right',
text: [
{ text: page.toString(), italics: true },
' of ',
{ text: pages.toString(), italics: true }
]
}
],
margin: [10, 0]
}
});
]
});
【问题讨论】:
标签: javascript jquery datatable