首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >数据表导出不工作

数据表导出不工作
EN

Stack Overflow用户
提问于 2015-08-05 02:10:45
回答 1查看 650关注 0票数 0

我正在尝试导出表,但不知何故导出功能不起作用。

这是我的脚本:--

代码语言:javascript
复制
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文件。

任何帮助都是很棒的。

致以敬意,

EN

回答 1

Stack Overflow用户

发布于 2015-08-30 04:35:17

能够解决这个问题。错误地调用脚本和JS。

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31816316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档