DataTable TableTools按钮无法正常工作(简单示例) [英] DataTables TableTools buttons not working correctly (simple example)

查看:321
本文介绍了DataTable TableTools按钮无法正常工作(简单示例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用最新的tableTool 2.2.0,我已经做了一个简单的例子。 jsfiddle.net/9ZTGb /

I am trying to use the newest tableTool 2.2.0 and i have made a little and simple example jsfiddle.net/9ZTGb/

COPY和PRINT按钮似乎响应,但是复制导致空白,CSV,Excel,PDF 似乎没有工作在所有..

COPY and PRINT buttons seems to respond, but the "Copy" is resulting "blank", and "CSV","Excel","PDF" seems not workinkg at all..

这是表:

<table id="tblExport" class="table table-condensed">
    <thead>
        <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Username</th>
            <th>Status</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>Larry</td>
            <td>Smith</td>
            <td>@lsmith</td>
            <td>Approved</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Mark</td>
            <td>Williams</td>
            <td>@mwills</td>
            <td>Pending</td>
        </tr>
        <tr>
            <td>3</td>
            <td>Jeremy</td>
            <td>Jones</td>
            <td>@jj</td>
            <td>Success</td>
        </tr>
        <tr>
            <td>4</td>
            <td>Carlos</td>
            <td>Martin</td>
            <td>@cmar</td>
            <td>Suspende</td>
        </tr>
    </tbody>
</table>

这是js脚本:

$(document).ready(function () {
     $('#tblExport').dataTable({
         "sDom": 'T<"clear">lfrtip',
             "oTableTools": {
             "sSwfPath": "https://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
                 "aButtons": ["copy", "csv", "xls", "pdf", "print"]
         }
     });
 });

如果有人告诉我为什么它不工作,我真的很感激。这里的例子和jsfiddle我试图尽可能简单,但仍然没有真正的工作。

I would really appreciate if someone could tell me why it isn't working. the example here and the jsfiddle i tried to make as simple as possible, but still not really working..

推荐答案

sSwfPath:Flash文件安全是问题:

sSwfPath : Flash file Security is the Issue:

解决方案:

步骤1:检查sDom属性。

Step 1: Check For sDom Property.

步骤2:检查SWF路径是否正确。如果它的正确

Step 2: Check the SWF Path is correct. If its correct

步骤3:打开Flash管理器:

Step 3: Open Flash Manager :

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

在第3个选项卡下,全局设置
添加包含SWF路径的站点URL。
选择始终允许选项。

Under 3rd Tab, Global Settings Add the Site Url Which contains SWF Path. Select Always Allow Option.

然后尝试通过刷新保存PDF。

Then Try the Save PDF By Refresh.

这篇关于DataTable TableTools按钮无法正常工作(简单示例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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