TableTools 插件导出按钮不起作用 [英] TableTools plugin export buttons are not working

查看:18
本文介绍了TableTools 插件导出按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 TableTools 来实现导出功能,但它不起作用.只有打印按钮工作和显示弹出和隐藏.我从 this 线程但没有给我明确的想法.下面是我的实现

I am using TableTools for export functionality but it is not working. Only print buttin working and shows pop up and hide. I have got suggestions from this thread but did not given clear idea to me. Below is my implementation

 $('#example').dataTable({
  "sDom": 'T<"clear">lfrtip',
   "oTableTools": {
    "sSwfPath": "copy_csv_xls_pdf.swf"
     }
  });

我将 .swf 文件保存在我的服务器页面所在的同一文件夹中.我也试过 "sDom": 'T<"clear"><"H"lfr>t<"F"ip>',.但对我不起作用.我还收到了一些需要配置的 Flash 播放器的安全设置的建议.使用此功能是否需要 Flash Player?.或者在实施中出了什么问题.请建议.

I have kept .swf file in the same folder where my server page is exist. Also I tried with "sDom": 'T<"clear"><"H"lfr>t<"F"ip>',. But not worked for me. Also I got suggestion that there is some security setting of the flash player which need to configure. Is flash player required for using this functionality?. Or what is going wrong in the implementation. Please suggest.

推荐答案

两条重要规则:

1) 您必须包含 TableTools 脚本,例如

1) You must include the TableTools-script, eg

<script type="text/javascript" src="DataTables-1.x.x/extras/TableTools/media/js/TableTools.min.js"></script> 

DataTables-1.x.x/ = 您的数据表版本的路径.

DataTables-1.x.x/ = your path to your version of datatables.

2) 只有打印按钮有效的事实强烈建议您的 .swf-path 是错误的.打印由数据表本身在 javascript 中完成 - 复制、excel 等由 flash 插件完成.

2) The fact that only the print-button works strongly suggest your .swf-path is wrong. Print is done in javascript by datatables itself - copy, excel etc is done by the flash-plugin.

永远不要改变 .swf 的路径!!让 .swf 保持原样,eg

Dont ever change the path for the .swf !! Let the .swf stay where it is, eg

sSwfPath: "DataTables-1.x.x/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"

没有安全问题或 TableTools 导出功能工作所需的其他先决条件.它应该是开箱即用的.

There is no security issues or other prerequisities needed for the TableTools export functions to work. It should work right out of the box.

当您确保 1) 和 2) 这只是初始化

When you have ensured 1) and 2) this simply initialization

var table =  $('#example').dataTable({
    sDom: 'TC<"clear">lfrtip',
    oTableTools: {
        sSwfPath: "DataTables-1.x.x/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
    }
});

将生成一个带有全功能导出按钮的数据表:

will produce a datatable with fully functional export-buttons :

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

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