jQuery dataTables - TableTools不工作 [英] jQuery dataTables - TableTools not working

查看:166
本文介绍了jQuery dataTables - TableTools不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的本地使用 http://datatables.net/extensions/tabletools/ -host(wamp服务器)。它的工作正常,但当我把相同的代码在我的在线服务器,它是不工作。

I'm using http://datatables.net/extensions/tabletools/ in my local-host ( wamp server ). It's working fine, but when I put the same code on my online server, it isn't working.

我正在使用所有最新版本的数据表

I am using all latest version of datatables

tableTools: {
    "sSwfPath": "https://datatables.net/release-datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
    "sRowSelect": "os",
    "sRowSelector": 'td:first-child',
    // "aButtons": [ "copy", "csv", "xls","pdf","print","select_all", "select_none" ]
    "aButtons": [
        "copy",
        "print", {
            "sExtends": "collection",
            "sButtonText": "Save", // button name 
            // "aButtons":    [ "csv", "xls", "pdf" ]
            "aButtons": [
                "csv",
                "xls", {
                    "sExtends": "pdf",
                    "sPdfOrientation": "landscape",
                    "sPdfMessage": "List of product."
                },
                "print"
            ]
        }
    ]
}    

首先没有点击copy,pdf,csv,xls按钮。因此我教我的路径或swf不工作,因此我更换了在线链接的链接。所以现在我点击,但当我单击复制按钮它给我一个消息...但是当我在我的记事本过去,它给我空白。另外我的pdf,csv,xlsx不工作。只有打印工作完美。请让我知道什么是问题,因为在我的localhost一切正常工作。在我的在线服务器中创建问题。

Firstly there was no click on copy, pdf, csv, xls button. Hence I taught my path or swf is not working hence I replaced the link with online link. Hence now I get click, but when I click Copy button it gives me a message ... but when I past in my notepad it's giving me "blank ". Also my pdf, csv, xlsx is not working. Only Print is working perfect. Please let me know what is the issue as in my localhost all is working fine. Its creating issues in my online server.

推荐答案

我确定datatables.net积极阻止使用 .swf 。 Allan Jardine评论了 .swf 文件的直接使用

I am pretty sure that datatables.net actively is blocking for use of the .swf. Allan Jardine has commented the direct use of the .swf files several times :


datatables.net不是CDN服务器,不应该这样使用。它
不是设计为,我可能添加节流在
中的热链接,因为大量的带宽正在使用,并导致
不必要的负载。

datatables.net is not a CDN server and should not be used as such. It is not designed to be, and I might add throttling for hotlinking in future as a huge amount of bandwidth is being used and causing unnecessary load. You'll get much better performance from using a proper CDN or even a locally hosted file.

但是,在使用
正确的CDN或者本地托管文件时, 1.10.x的引入终于建立了一个真正的CDN服务器,包括所有的TableTools资源 - > http:// cdn .datatables.net / tabletools / 2.2.2 /

However, with the introduction of 1.10.x there is finally established a real CDN server, including all the TableTools resources -> http://cdn.datatables.net/tabletools/2.2.2/

因此,将 sSwfPath 替换为:

http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf

http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf

这篇关于jQuery dataTables - TableTools不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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