jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Export jqxgrid to excel
Tagged: angular grid, excel, export, Exportdata, grid, jquery grid, jqxgrid, save-file.php, variable
This topic contains 21 replies, has 8 voices, and was last updated by Dimitar 8 years, 9 months ago.
-
AuthorExport jqxgrid to excel Posts
-
hii Dimitar,
i tried to generate export to excel but shows error on click as save-file.php
if i will took as local variable it will return data in xml format and could not able to save it also.Please help my code is below
@{ ViewBag.Title = "Export"; } <html lang="en"> <head> <title id='Description'>With jqxGrid, you can export your data to Excel, XML, CSV, TSV, JSON, PDF and HTML.</title> <link href="../../Content/jqwidgets/styles/jqx.base.css" rel="stylesheet" type="text/css" /> <script src="../../Content/js/jquery-1.11.3.min.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxcore.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxbuttons.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxscrollbar.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxmenu.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxcheckbox.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxgrid.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxgrid.selection.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxgrid.columnsresize.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxdata.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxdata.export.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxgrid.export.js" type="text/javascript"></script> <script src="../../Content/jqwidgets/jqxgrid.sort.js" type="text/javascript"></script> <script src="../../Scripts/tableExport.js" type="text/javascript"></script> <script src="../../Scripts/jquery.base64.js" type="text/javascript"></script> <script src="../../Scripts/html2canvas.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var source = { datatype: "json", datafields: [ { name: 'regid', type: 'int' }, { name: 'fname', type: 'string' }, { name: 'lname', type: 'string' }, { name: 'sex', type: 'string' }, { name: 'profession', type: 'string' }, { name: 'dob', type: 'date' }, { name: 'emailid', type: 'string' }, { name: 'contactno', type: 'string' }, { name: 'username', type: 'string' }, { name: 'address', type: 'string' }, { name: 'state', type: 'string' }, { name: 'city', type: 'string' }, { name: 'pincode', type: 'string' }, ], url: 'Employee/GetEmployees' }; var dataAdapter = new $.jqx.dataAdapter(source); // initialize jqxGrid $("#grid").jqxGrid( { width: 850, source: dataAdapter, columns: [ { text: "regid", datafield: "regid" }, { text: "fname", datafield: "fname" }, { text: "lname", datafield: "lname" }, { text: "sex", datafield: "sex" }, { text: "profession", datafield: "profession" }, { text: "dob", datafield: "dob" }, { text: "emailid", datafield: "emailid" }, { text: "contactno", datafield: "contactno" }, { text: "username", datafield: "username" }, { text: "address", datafield: "address" }, { text: "state", datafield: "state" }, { text: "city", datafield: "city" }, { text: "pincode", datafield: "pincode" } ] }); $("#excelExport").jqxButton({ theme: 'energyblue' }); $("#xmlExport").jqxButton(); $("#csvExport").jqxButton(); $("#tsvExport").jqxButton(); $("#htmlExport").jqxButton(); $("#jsonExport").jqxButton(); $("#pdfExport").jqxButton(); var exportInfo; $("#excelExport").click(function () { exportInfo = $("#grid").jqxGrid('exportdata', 'xls'); }); $("#xmlExport").click(function () { $("#grid").jqxGrid('exportdata', 'xml', 'grid'); }); $("#csvExport").click(function () { $("#grid").jqxGrid('exportdata', 'csv', 'grid'); }); $("#tsvExport").click(function () { $("#grid").jqxGrid('exportdata', 'tsv', 'grid'); }); $("#htmlExport").click(function () { $("#grid").jqxGrid('exportdata', 'html', 'grid'); }); $("#jsonExport").click(function () { $("#grid").jqxGrid('exportdata', 'json', 'grid'); }); $("#pdfExport").click(function () { $("#grid").jqxGrid('exportdata', 'pdf', 'grid'); }); }); </script> </head> <body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="grid"></div> <div style='margin-top: 20px;'> <div style='float: left;'> <input type="button" value="Export to Excel" id='excelExport' /> <br /><br /> <input type="button" value="Export to XML" id='xmlExport' /> </div> <div style='margin-left: 10px; float: left;'> <input type="button" value="Export to CSV" id='csvExport' /> <br /><br /> <input type="button" value="Export to TSV" id='tsvExport' /> </div> <div style='margin-left: 10px; float: left;'> <input type="button" value="Export to HTML" id='htmlExport' /> <br /><br /> <input type="button" value="Export to JSON" id='jsonExport' /> </div> <div style='margin-left: 10px; float: left;'> <input type="button" value="Export to PDF" id='pdfExport' /> </div> </div> </div> </body> </html>
Hi manojjoon,
What is the error you receive regarding save-file.php?
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
We have licence purchased – how do we go about getting save-file.php ? Is there a separate download ?
B
Hi B,
It is available along with the jQWidgets source code from the Client Services Portal. For more information, please check the email you have received after purchasing the license.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/nevermind, we got it 🙂
B
Hi,
I am not able to see the ‘save-file.php’ in source code. We have a enterprise license. Please let me know the I want to host this file on our server.Hi WeitzLux,
You can find the export PHP file in the jQWidgets Source code package (accessible from the jQWidgets Client Portal) in the folder
PHPExport
.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.