javascript - By using kendo how to export the grid data to any one of the following files (csv,excel ,Pdf) - Stack Overflow

I am filling the data into Kendogrid using remote data.So is it possible to export data the data in the

I am filling the data into Kendogrid using remote data.So is it possible to export data the data in the grid to any files like csv,excel and pdf using kendoUI.

   <script>
    $(document).ready(function() {
                            $("#grid").kendoGrid({
                                dataSource: {
                                    type: "odata",
                                    transport: {
                                        read: ".svc/Orders"
                                    },
                                    schema: {
                                        model: {
                                            fields: {
                                                OrderID: { type: "number" },
                                                Freight: { type: "number" },
                                                ShipName: { type: "string" },
                                                OrderDate: { type: "date" },
                                                ShipCity: { type: "string" }
                                            }
                                        }
                                    },
                                    pageSize: 10,
                                    serverPaging: true,
                                    serverFiltering: true,
                                    serverSorting: true
                                },
                                height: 250,
                                filterable: true,
                                sortable: true,
                                pageable: true,
                                columns: [{
                                        field:"OrderID",
                                        filterable: false
                                    },
                                    "Freight",
                                    {
                                        field: "OrderDate",
                                        title: "Order Date",
                                        width: 100,
                                        format: "{0:MM/dd/yyyy}"
                                    }, {
                                        field: "ShipName",
                                        title: "Ship Name",
                                        width: 200
                                    }, {
                                        field: "ShipCity",
                                        title: "Ship City"
                                    }
                                ]
                            });
                        });
                    </script>

I am filling the data into Kendogrid using remote data.So is it possible to export data the data in the grid to any files like csv,excel and pdf using kendoUI.

   <script>
    $(document).ready(function() {
                            $("#grid").kendoGrid({
                                dataSource: {
                                    type: "odata",
                                    transport: {
                                        read: "http://demos.kendoui./service/Northwind.svc/Orders"
                                    },
                                    schema: {
                                        model: {
                                            fields: {
                                                OrderID: { type: "number" },
                                                Freight: { type: "number" },
                                                ShipName: { type: "string" },
                                                OrderDate: { type: "date" },
                                                ShipCity: { type: "string" }
                                            }
                                        }
                                    },
                                    pageSize: 10,
                                    serverPaging: true,
                                    serverFiltering: true,
                                    serverSorting: true
                                },
                                height: 250,
                                filterable: true,
                                sortable: true,
                                pageable: true,
                                columns: [{
                                        field:"OrderID",
                                        filterable: false
                                    },
                                    "Freight",
                                    {
                                        field: "OrderDate",
                                        title: "Order Date",
                                        width: 100,
                                        format: "{0:MM/dd/yyyy}"
                                    }, {
                                        field: "ShipName",
                                        title: "Ship Name",
                                        width: 200
                                    }, {
                                        field: "ShipCity",
                                        title: "Ship City"
                                    }
                                ]
                            });
                        });
                    </script>
Share Improve this question edited Jan 23, 2013 at 5:11 Arun Killu 14.3k5 gold badges37 silver badges65 bronze badges asked Jan 23, 2013 at 5:04 user1877936user1877936 3633 gold badges8 silver badges26 bronze badges 5
  • 1 you can read the full datasource using $("#grid").data("kendoGrid").dataSource.data() – Arun Killu Commented Jan 23, 2013 at 5:13
  • this has nothing to do with kendo actually you are generating the data .and you can convert it to any format. – Arun Killu Commented Jan 23, 2013 at 5:22
  • when ever user clicks the button I need to export the data.I tired like this but no use. $("#download").click(function () { var json = $.parseJSON($("#json").val()); var csv = JSON2CSV(json); window.open("data:text/csv;charset=utf-8," + escape(csv)) }); – user1877936 Commented Jan 23, 2013 at 5:26
  • is it possible to change the file name .Presently I am getting download.xls I want to change this name – user1877936 Commented Mar 13, 2013 at 10:31
  • I append the response.Addheader but no use .and It was showing as unexpected identifier error – user1877936 Commented Mar 13, 2013 at 10:34
Add a ment  | 

3 Answers 3

Reset to default 2

Kendo UI now supports export to both Excel and PDF. http://demos.telerik./kendo-ui/grid/excel-export

Unfortunately there isn't any built in functionality for exporting the grid.

There is a code library example that demonstrates this if you are using ASP.NET MVC but I don't know of one if you are not using MVC. According to some forum answers they do not have plans to build this in which I don't like and hope we as users can vote for this feature.

Here is a link that may be of help it shows how to export a json response to cvs.

So what you want to do is get the datasource of your grid and call .toJson Something like this

      var mydata= $("#grid").data("kendoGrid").dataSource.data().toJson();

Then pass that to the function in the link I provided

Also note: you may need to get the view of the datasource if you want to include the filtering and paging, at least I think. view would be dataSource.view()

Hope this helps.

On github I have a project that allows you to download the Grid to a CSV: Kendo Grid CSV Export

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744634986a4585091.html

相关推荐

  • 重装系统只影响C盘吗?深入解析系统重装的全过程

    重装系统只影响C盘吗?深入解析系统重装的全过程 在计算机的日常使用中,重装系统是一个常见的操作,尤其是在系统出现故障、感染病毒或需要优化系统性能时。然而,许多用户对于重装系统的具体过程和影响存在误解,认为重装系统仅仅是对C盘进行清空和重置

    46分钟前
    10
  • 大模型驱动金融数据应用的实战探索

    近年来,人工智能技术的飞速发展正在重塑全球各行各业的生态格局,金融行业作为数据密集型领域,更是首当其冲。大模型凭借其强大的自然语言处理、逻辑推理和生成能力,逐渐成为金融数据应用的核心驱动力。本文将从行业背景与趋势、核心场景重构、产品能力提升

    45分钟前
    00
  • maxwell遇到的一则问题

    结论和原因maxwell的元数据库里面没有存储全部的schema数据(就是少数据了),导致相关表的DDL校验失败。PS:我这里maxwell的作用只是采集库表修改情况的统计粗粒度指标,因为之前maxwell在运行报错的时候,直接修改了pos

    42分钟前
    00
  • 人工智能与ai有什么区别

    一、引言:概念之辨的必要性在科技浪潮席卷全球的当下,人工智能(Artificial Intelligence,简称AI)已成为人们耳熟能详的词汇。然而,当我们深入探讨时,会发现“人工智能”与“AI”这两个表述在语义和使用场景上存在微妙差异。

    40分钟前
    00
  • 在VMware虚拟机中安装Windows 7全攻略(避坑指南)

    ⚠️写在前面 最近发现很多开发者在调试老旧系统时都需要用到Windows 7环境&#xff08;特别是银行、医疗等行业的遗留系统&#xff09;&#xff0c;但实体机安装既不现实也不安全。今天就手把手教你在虚拟机

    38分钟前
    00
  • Nat. Mater.

    大家好,今天给大家分享一篇近期发表在Nat. Mater.上的研究进展,题为:De novo design of self-assembling peptides with antimicrobial activity guided

    37分钟前
    00
  • 最后讲一遍:ChatGPT 快速生成国内外研究现状的方法

    在科研工作中,梳理国内外研究现状有助于明确研究方向,发现研究空白,为后续研究提供理论支持与创新思路。本文将详细介绍如何借助 ChatGPT 高效生成国内外研究现状,帮助您在有限时间内构建全面、专业的文献综述框架,提升学术写作效率与质量。St

    35分钟前
    00
  • 雨晨 22635.5170 Windows 11 企业版 23H2 轻装版

    文件: 雨晨 22635.5170 Windows 11 企业版 23H2 轻装版 install.esd 大小: 2920270404 字节 修改时间: 2025年4月8日, 星期二, 11 : 04 : 59 MD5: D5F8F0AD

    35分钟前
    00
  • 人工智能适合什么人学

    一、引言:人工智能浪潮下的新机遇在当今科技飞速发展的时代,人工智能(AI)无疑是最为耀眼的技术明星之一。从智能语音助手到自动驾驶汽车,从医疗诊断辅助到金融风险预测,人工智能正以前所未有的速度改变着我们的生活和工作方式。随着全球领先的终身学习

    34分钟前
    00
  • 子网掩码是怎么“掩”的?用积木教你彻底搞懂!

    子网掩码是怎么“掩”的?用积木教你彻底搞懂!前言肝文不易,点个免费的赞和关注,有错误的地方请指出,看个人主页有惊喜。作者:神的孩子都在歌唱你是不是也曾被“子网掩码”这个术语搞得晕头转向?明明是学网络的第一步,却像是打开了数学世界的大门:2

    32分钟前
    00
  • Java&amp;Activiti7实战:轻松构建你的第一个工作流

    本文已收录在Github,关注我,紧跟本系列专栏文章,咱们下篇再续!

    28分钟前
    00
  • 人工智能应用领域有哪些

    人工智能应用领域有哪些一、引言随着科技的飞速发展,人工智能(AI)已经逐渐渗透到我们生活的方方面面,成为推动社会进步的重要力量。从医疗健康到金融服务,从教育学习到智能制造,人工智能以其独特的技术优势,为各行各业带来了前所未有的变革。本文旨在

    26分钟前
    10
  • win11家庭版改为专业版

    找到“我的电脑”--“设置”--“系统”--“激活”--“更改密钥” 输入密钥“G49HN-9YQCT-684C3-R7T3F-3DBQB 即可成功。

    19分钟前
    00
  • VoidZero 的野心,开发者的福音!

    前言昨天分享了尤雨溪公司 VoidZero 最新的产品 TSDown,我相信肯定有同学和我一样好奇,尤雨溪为什么要推出这么多工具,来增加大家的学习压力!今天我们从整体上分析下,这些产品的功能和目的!正文VoidZero 是尤雨溪于 2020

    19分钟前
    00
  • 解决Windows 10家庭单语言版语言限制:升级专业版全攻略

    解决Windows 10家庭单语言版语言限制:升级专业版全攻略 在日常使用Windows 10系统时,部分用户可能会遇到系统提示“当前许可证仅支持单一显示语言”的困扰。这一问题通常出现在预装或激活了Windows 10家庭单语言版的设备上

    19分钟前
    00
  • 电子产品设计与电源优化实用策略

    产品降成本是商业活动中的常见行为,可贯穿于产品设计、研发、生产、运输、销售及维护的各个环节。然而,降成本策略必须建立在对产品品质要求不降低的基础上,确保设计参数满足要求并通过相关测试。以下是具体优化与深度分析。研发工程师通常从设计入手,选择

    18分钟前
    00
  • 精选 5 款基于 .NET 开源、功能强大的编辑器

    前言今天大姚给大家分享 5 款基于 .NET 开源、免费、功能强大的编辑器,其中包含 C# 代码编辑器、文本编辑器、CSV 文本编辑器和 Markdown 编辑器。NetPadNetPad是一个基于.NET开源(MIT License)、跨

    5分钟前
    10
  • Windows 10 LTSC 2019 中文版下载及安装教程(附安装包)

    &#xff08;cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24&#xff09;涵盖常见疑问和注意事项&#xff1a; cn_windows_10_enterpr

    4分钟前
    10
  • Windows 10 64位系统安装全攻略:从工具选择到系统激活的完整指南

    Windows 10 64位系统安装全攻略:从工具选择到系统激活的完整指南 在数字化办公时代,Windows 10系统凭借稳定的内核、丰富的应用生态和持续的官方支持,仍然是个人用户和企业用户的首选操作系统。本文将以Windows 10 6

    2分钟前
    00
  • 深入理解 ASP.NET Core 中的 IOptions

    在 ASP.NET Core 中,配置管理是一个核心功能,它允许我们以灵活的方式读取和管理应用程序的配置信息。IOptions 是 ASP.NET Core 提供的一种强大的配置模式,用于将配置数据注入到应用程序的各个部分。通过 IOpti

    47秒前
    00

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信