【发布时间】:2018-07-27 22:40:42
【问题描述】:
您好,我在 AdminLte 中使用 Datatables,并且我正在尝试包含 Datatables 的导出按钮,当使用没有任何管理员的普通 html 时,它的工作正常 但是当我试图将它与 ADMINLTE 集成时,导出按钮就像这样丢失了 我的代码是这样的
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css">
<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.bootstrap.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.print.min.js"></script>
<script> $('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
{extend:'excel',action:newExportAction}
],
"processing": true,
"serverSide": true,
"ajax": "http://localhost/data/verify/getDataEmployeeFromMantra"
} );</script>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>No Employee</th>
<th>Tanggal Lahir</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Gender</th>
<th>Hiredate</th>
</tr>
</thead>
<tfoot>
<tr>
<th>No Employee</th>
<th>Tanggal Lahir</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Gender</th>
<th>Hiredate</th>
</tr>
</tfoot>
</table>
知道为什么 adminlte 中缺少导出按钮吗?已经包含引导按钮buttons.bootstrap.min.js
【问题讨论】:
-
你检查控制台了吗?也许你会从那里得到提示。
-
还有一件事你在哪里定义了
newExportAction函数? -
已经定义了 newExportAction 并且控制台开发人员没有错误,我会尝试重新部署 adminlte,可能它与来自 admin lte 的数据表冲突:(
标签: php jquery datatables