jqgrid 导出到 Excel 路线图?
有谁知道 JQGrid 何时会内置导出到 Excel/CSV 的功能?
有一些解决方法,但我们正在寻找一些简单的功能。
Does anyone know when an export to Excel/CSV function is going to be built into JQGrid?
There are a handful of workarounds but we're looking for some simple functionality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅jqgrid 是否支持“开箱即用”导出到 excel 还是我需要编写一些服务器端代码?
我不隶属于 jqGrid 团队,但我不认为有任何计划将 Excel 导出构建到本机 jqGrid JavaScript 库中。您可能必须为此购买 php 或 ASP.NET 库,因为 Excel 生成需要服务器端处理。
用 JavaScript 编写一个 JSON 到 CSV 的转换器并不太难,但你真的想这样做吗?另外,我真的想不出一种纯粹通过 JavaScript 向用户提供文件的方法。这个问题似乎使用 js & 解决了这个问题。 Flash 在 javascript 中生成一些 xml,提示用户保存它假设
您想要生成 Excel 服务器端,您最好的选择是购买付费产品,或者使用与网格相同的数据源编写自己的代码来完成此操作。
see Does jqgrid support exporting to excel " out of the box" or do i need to write some server side code?
I'm not affiliated with the jqGrid team, but I don't think there are any plans in the works to build the Excel export into the native jqGrid JavaScript library. You probably have to buy the php or ASP.NET libraries for that since the Excel generation requires server-side processing.
It wouldn't be too hard to write a JSON-to-CSV converter in JavaScript, but do you really want to ? Also, I can't really think of a way to serve a file to a user purely via JavaScript. This question appears to address that problem using js & Flash Generate some xml in javascript, prompt user to save it
Assuming you want to generate the Excel server-side, your best bet is to either buy the paid product, or write your own code to do it using the same datasource as the grid.
这是一个旧线程,但以防万一其他人遇到这个问题。
几年前,我编写了一个 C# 类,可让您将任何
DataSet
、DataTable
或List
导出到“真正的”Excel文件,使用 OpenXML 库,通过一行代码。C# ExportToExcel 库
然后我记录了一个 JavaScript 库,它可以让您从以下位置调用此 C# 代码jqGrid 中的“导出”按钮:
此处的完整详细信息:
从 jqGrid 导出到 Excel
唯一的问题是您的
jqGrid
必须将loadonce
值设置为 true。如果不是,我的 JavaScript 代码将无法访问需要导出到 Excel 的整个数据集。希望这有帮助。
This is an old thread, but just in case anyone else hits this issue.
A few years ago, I wrote a C# class which let you export any
DataSet
,DataTable
orList<>
to a "real" Excel file, using the OpenXML libraries, with one line of code.C# ExportToExcel library
I then documented a JavaScript library which would let you call this C# code from an Export button in your jqGrid:
Full details here:
Export to Excel from jqGrid
The only gotcha is that your
jqGrid
must have theloadonce
value set to true. If it isn't, my JavaScript code doesn't have access to the entire set of data which needs to be export to Excel.Hope this helps.