我正在尝试导出表,但某种程度上导出功能无效。
这是我的剧本: -
var editor;
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "http://localhost:8080//TestQuartz/json/agent.json",
table: "#agents",
});
$('#agents').dataTable( {
dom: "Tfrtip",
ajax: "http://localhost:8080//TestQuartz/json/agent.json",
tableTools: {
sRowSelect: "os",
sSwfPath: "../TableTools/swf/copy_csv_xls_pdf.swf",
aButtons: [
{ sExtends: "editor_create", editor: editor },
{ sExtends: "editor_edit", editor: editor },
{ sExtends: "editor_remove", editor: editor },
{
sExtends: "collection",
sButtonText: "Save",
sButtonClass: "save-collection",
aButtons: [ 'copy', 'csv', 'xls', 'pdf' ]
},
'print'
]
}
} );
} );
</script>
我一直低于错误: - 未捕获的TypeError:$ .fn.dataTable.Editor不是函数
我能够构建表,但是当我添加导出功能时,它失败了。 我试图在sb-admin表中集成导出功能。 我已经包含了所有必需的JS文件。
任何肝脏都会很棒。
此致
答案 0 :(得分:0)
能够解决问题。正在错误地调用脚本和JS。
<script>
var editor;
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "../json/agent.json",
table: "#agents",
} );
$('#agents').dataTable( {
dom: "Tfrtip",
ajax: "../json/agent.json",
"scrollX": true,
"ordering": false,
tableTools: {
sRowSelect: "os",
sSwfPath: "../TableTools/swf/copy_csv_xls_pdf.swf",
aButtons: [
{
sExtends: "collection",
sButtonText: "Save",
sButtonClass: "save-collection",
aButtons: [ 'copy', 'xls', 'pdf' ]
}
]
}
} );
} );
</script>