我想知道是否有可能在将数据从datatables导出到xls文件之前让数据表首先要求输入密码。我试过javascript但显然数据表使用flash player将数据导出到文件。因此,在javascript或jquery中捕获的点击事件没有。有人有答案吗?我会给出我的代码段,但我认为它不会有帮助。感谢。
var table = $('.example').DataTable( {
// dom: '<"col_10 pt_5 pb_5"B><"clear">lf',
dom: 'B<"pt_5"l>f',
processing: true,
serverSide: true,
ajax:{
url:'<?php echo site_url().'/student/leads/ajax'; ?>',
cache: false,
data: function(d){
d.startdate = $('#date_from').val(),
d.enddate = $('#date_to').val()
}
},
iDisplayLength: 20,
order: [ [ 0, "desc" ] ],
aLengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]],
aoColumns: [
{"sTitle": "id", "sWidth": "8%"},
{"sTitle": "Name", "sWidth": "8%"},
{"sTitle": "E-mail", "sWidth": "12%"},
{"sTitle": "Telp", "sWidth": "8%"},
{"sTitle": "Placement Date", "sWidth": "8%"},
{"sTitle": "Register", "sWidth": "9%"},
{"sTitle": "Teacher State", "sWidth": "11%"},
{"sTitle": "Trial", "sWidth": "7%"},
{"sTitle": "Study", "sWidth": "13%"}
],
buttons: [
{
extend: 'excel',
text: 'Export to Excel'
}
],
bAutoWidth: false
});
答案 0 :(得分:0)
您可以首先制作两个按钮,要求登录数据库(创建带有输入用户和密码的表单)然后如果用户是正确的,则显示另一个按钮,让用户下载xls文件。