jQuery数据表中的纯HTML导出按钮 [英] Pure HTML export buttons in jQuery Data Table

查看:157
本文介绍了jQuery数据表中的纯HTML导出按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery DataTables。它提供一组导出按钮。但是那些按钮是swf按钮。



我想要下拉按钮。我已经经历了帮助,但是找不到这样的代码来设置HTML5内置的Flash按钮。



我想下拉按钮如下


导出

- PDF

- CSV

- HTML

- Excel


以上按钮是HTML标签的集合(通常是HTML中的内容)。可以这样做吗?



编辑:



我想生成按钮使用按钮 div ul li 我们通常在常规HTML文件中进行的标签组合。

解决方案

解决方案



使用不使用Flash的HTML5导出按钮的代码。

  var table = $('#example')。DataTable({
dom:'Bfrtip',
按钮:[
{
extends:'collection',
文本:'Export',
按钮:['pdfHtml5','csvHtml5','copyHtml5','excelHtml5']
}
]
});

您需要使用下载构建器,以包含DataTables,按钮,HTML5导出,JSZip和pdfmake库,以生成链接到CDN的JS / CSS文件。



< h3> DEMO

请参阅这个jsFiddle 代码和演示。



LINKS




I am using jQuery DataTables. It provides set of export buttons. But those buttons are swf buttons.

I would like to have HTML drop down buttons. I have gone through its help but could not found such code to set HTML5 buttons other than built in Flash.

I would like to have drop down buttons like below

Export
- PDF
- CSV
- HTML
- Excel

Above buttons are set of HTML tags (generally what they are in HTML). Can I do that?

Edit:

I would like to generate buttons using button, div, ul, li tags combination which we generally do in our regular HTML files.

解决方案

SOLUTION

Use the code below for HTML5 export buttons that don't use Flash.

var table = $('#example').DataTable({
    dom: 'Bfrtip',
    buttons: [
      {
         extend: 'collection',
         text: 'Export',
         buttons: [ 'pdfHtml5', 'csvHtml5', 'copyHtml5', 'excelHtml5' ]
      }
   ]
});

You need to use Download Builder to include DataTables, Buttons, HTML5 export, JSZip and pdfmake libraries to produce links to CDN for JS/CSS files.

DEMO

See this jsFiddle for code and demonstration.

LINKS

这篇关于jQuery数据表中的纯HTML导出按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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