此代码工作正常,但没有更改任何内容,导出按钮不显示。
我已将这些库插入正确的位置:
$this->document->add_css('jquery.datetimepicker.css');
$this->document->add_css('dataTables.tableTools.min.css');
$this->document->add_js('jquery.datetimepicker.js');
$this->document->add_js('jquery.dataTables.min.js');
$this->document->add_js('dataTables.tableTools.js');
这是我的代码:
$(".table-dashboard").DataTable({
"dom": "T<\'clear\'>lfrtip",
initComplete: function(){
$(".scrollable-list").before($(".DTTT_container"));
$(".DTTT_container").css("margin-bottom", "-33px");
},
bFilter: false,
"aoColumnDefs":
[
{
"bSortable": false,
"aTargets": [$(this).find("thead tr th").length - 1]
}
],
"oTableTools":
{// "sSwfPath": "'.base_url(SYSTEM_MEDIA . "swf/copy_csv_xls_pdf.swf").'",
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf",
"aButtons":
[
{
"sExtends" : "csv",
"sButtonText" : "Export CSV <i class=\'fa fa-file-excel-o\'></i>",
"sButtonClass" : "btn btn-primary"
}
]
}
});
答案 0 :(得分:0)
我自己创立了解决方案,我添加了一些缺失的库。
Introducing FOREIGN KEY constraint '_test_cascade_constraint' on table
'_test_cascade' may cause cycles or multiple cascade paths. Specify ON
DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY
constraints.
脚本:
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script>