[英]How do I add element to be printed using dataTable print button?
I use DataTable print button to print files. 我使用DataTable打印按钮来打印文件。 I'd like to add another
div
to be printed above or under the table. 我想在桌子上方或下方添加另一个
div
。
I use this script in datatable to add some header 我在datatable中使用这个脚本来添加一些标题
title : "This should be another element printed above the DataTable<br /><span id='txt-small' style='font-size:'12px !important;'>Dates : </span>",
But, it's probably not the right method because I may add a complex header above the DataTable. 但是,它可能不是正确的方法,因为我可能会在DataTable上面添加一个复杂的标头。
I also use footer : true,
to add something to print in <tfoot>
but then again I may add a complex footer under the DataTable. 我也使用
footer : true,
在<tfoot>
添加要打印的内容但是我可以在DataTable下添加一个复杂的页脚。
So, how do I add another element div
or table
to be printed above or under the DataTable when I print the table? 所以,我怎么添加其他元素
div
或table
上面或数据表下打印时我打印表格?
You can use the customize
method: 您可以使用
customize
方法:
{
extend: 'print',
title: ' ',
message: ' ',
customize: function(win) {
$(win.document.body).append('<html elements here>'); //after the table
$(win.document.body).prepend('<html elements here>'); //before the table
}
},
Reference here : Customisation of the print view window 参考此处: 自定义打印视图窗口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.