[英]How do I pass the Id of the element from my DataTable into my button using jQuery/Ajax?
[英]How do I add element to be printed using dataTable print button?
我使用DataTable打印按钮来打印文件。 我想在桌子上方或下方添加另一个div
。
我在datatable中使用这个脚本来添加一些标题
title : "This should be another element printed above the DataTable<br /><span id='txt-small' style='font-size:'12px !important;'>Dates : </span>",
但是,它可能不是正确的方法,因为我可能会在DataTable上面添加一个复杂的标头。
我也使用footer : true,
在<tfoot>
添加要打印的内容但是我可以在DataTable下添加一个复杂的页脚。
所以,我怎么添加其他元素div
或table
上面或数据表下打印时我打印表格?
您可以使用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
}
},
参考此处: 自定义打印视图窗口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.