我正在尝试导出表,但不知何故导出功能不起作用。
这是我的脚本:--
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文件。
任何帮助都是很棒的。
致以敬意,
发布于 2015-08-30 04:35:17
能够解决这个问题。错误地调用脚本和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>https://stackoverflow.com/questions/31816316
复制相似问题