1 回答
TA贡献1757条经验 获得超8个赞
如上一篇文章所述(已删除),您共享了与 Jquery 数据表相关的所有 javascript 和 css 文件。
实际上您的链接包含不完整/错误的 HTML 链接标签。下面引用了你的一些错误:
<script type="text/javascript" charset="utf8" script
src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"</script>
你的错误是:
额外的script内部脚本标签
缺少脚本标记符号的收盘>前</script>
所以固定的会喜欢这个
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
使用固定链接运行下面的代码段
var information = [
{"EmpName":"Tiger Nixon","NumSales":100,"TotalSales":100,"LMonthSales":100,"2MonthSales":100},
{"EmpName":"Tiger Nixon","NumSales":100,"TotalSales":100,"LMonthSales":100,"2MonthSales":100},
{"EmpName":"Tiger Nixon","NumSales":100,"TotalSales":100,"LMonthSales":100,"2MonthSales":100}
]
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
data: information,
columns: [
{ data: "EmpName",title: "EmpName" },
{
data: "NumSales",
title: "NumSales",
render: $.fn.dataTable.render.number(",", ".", 2, '$')
},
{
data: "TotalSales",
title: "TotalSales",
render: $.fn.dataTable.render.number(",", ".", 2, '$')
},
{
data: "LMonthSales",
title: "LMonthSales",
render: $.fn.dataTable.render.number(",", ".", 2, '$')
},
{
data: "2MonthSales",
title: "2MonthSales",
render: $.fn.dataTable.render.number(",", ".", 2, '$')
}
]
} );
} );
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<table id="example" class="display" width="100%"></table>
添加回答
举报