导出到Excel在部署时不起作用 [英] Export to Excel not working when deployed

查看:133
本文介绍了导出到Excel在部署时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用来创建具有导出功能的数据表的代码。

This is the code I used to create a data table with export functionality.

oTable = $("#tblSearch").DataTable({
    "jQueryUI": true,
    "sPaginationType": "full_numbers",
    "iDisplayLength": 10,
    "bSort": true,
    "aaSorting": [[0, "desc"]],
    "lengthMenu": [[5, 10, 25, 50], [5, 10, 25, 50]],
    "autoWidth": true,
    "scrollCollapse": true,
    "dom": 'T<"clear">lfrtip',
    "tableTools": {
        "sSwfPath": "../../swf/copy_csv_xls.swf",
        "aButtons": ["xls"]
    }
});

导出在我的本地工作,但是当我部署在服务器上时,该按钮不会出现。 p>

Export is working in my local but when I deployed in server, the button does not appear.

推荐答案

sSwfPath 更改为绝对路径。

"tableTools": {
    "sSwfPath": "http://cdn.datatables.net/tabletools/2.2.3/swf/copy_csv_xls_pdf.swf",
    "aButtons": ["xls"]
}

这里使用dataTable CDN。问题是,当您部署到您的IIS或您正在使用的任何Windows平台时,相对路径会混乱。这是一个很常见的问题。

here using the dataTables CDN. The problem is, that the relative path messes up when you deploy to your IIS or whatever windows platform you are using. This is a very common problem.

这篇关于导出到Excel在部署时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆