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

查看:19
本文介绍了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"
            ]
        }
    ]
}    

首先没有点击复制、pdf、csv、xls 按钮.因此我教了我的路径或 swf 不起作用,因此我用在线链接替换了链接.因此,现在我得到了点击,但是当我点击复制按钮时,它给了我一条消息……但是当我在记事本中过去时,它给了我空白".我的 pdf、csv、xlsx 也不起作用.只有打印工作完美.请让我知道是什么问题,因为在我的本地主机中一切正常.它在我的在线服务器中产生了问题.

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 服务器,不应如此使用.它不是设计的,我可能会为盗链添加限制未来,因为大量带宽被使用并导致不必要的负载.使用适当的 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.

然而,随着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

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

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