从 Buttons 扩展 (Excel) 获取所有数据 [英] Get all data from Buttons extension (Excel)

查看:52
本文介绍了从 Buttons 扩展 (Excel) 获取所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用分页的数据表 - 没问题.需要包含导出到 Excel"按钮.因此,我们添加了Buttons"扩展并让数据导出正常.问题是:它只导出当前页面的数据,而不是整个数据集.我怎样才能得到整个数据集?可能吗?

We've got a DataTable working with paging - no problem. There's a requirement to include an "Export to Excel" button. So, we added the "Buttons" extension and have the data exporting just fine. The problem is this: it's only exporting the current page's data, not the entire set of data. How can I get the entire set of data? Is it possible?

$("dataTable-custom").dataTable({
    "paging": 1,
    buttons: ['excel],
    "serverSide": true,
    "ajax": {
        "url": "localget",
        "data": ...
        }

推荐答案

既不是 Buttons 扩展,也不是 TableTools 扩展(现已停用并由 Buttons) 能够在服务器端处理模式下导出所有数据.请参阅 jQuery DataTables 作者的此评论.

Neither Buttons extension nor TableTools extension (now retired and replaced by Buttons) have the ability to export all data in server-side processing mode. See this comment from the author of jQuery DataTables.

您可以:

  • 切换到客户端处理,这可能不是大型数据集的选项,或者
  • 通过向服务器发送用于生成表格的相同请求,在服务器上实现 Excel 生成.使用 ajax.params() 得到DataTables 在最后一次 Ajax 请求中提交给服务器的数据.

这篇关于从 Buttons 扩展 (Excel) 获取所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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