jqxGrid Export to Excel

With the latest release of jQWidgets, we enhanced the jqxGrid widget by adding new data exporting capabilities. Let’s see what’s necessary to export the grid’s data to excel. In order to use the Export to Excel feature, you need to load two additional Javascript files.
<script type="text/javascript" src="../../jqwidgets/jqxdata.export.js"></script> 
<script type="text/javascript" src="../../jqwidgets/jqxgrid.export.js"></script>
To export the Grid’s data to Excel and save it in a file, you need to call the ‘exportdata’ method with two parameters – the data format(‘xls’) and the file’s name.
$("#jqxgrid").jqxGrid('exportdata', 'xls', 'jqxGrid');  
Online Demo: http://jsfiddle.net/jqwidgets/6HRU8

About admin


This entry was posted in jQuery, jQuery Widgets, jqxGrid and tagged , , , . Bookmark the permalink.



3 Responses to jqxGrid Export to Excel

  1. Jon Morgan says:

    I work in an OpenOffice based environment. When I downloaded the XLS file and opened it in OpenOffice, it came back with an empty grid. Surprised, I tried the one machine we have which has Excel 2010, and got the message:

    “The file you are trying to open, ‘jqxGrid.xls’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?”

    Looking at the file directly it seems to be a raw XML file rather than being an XLS file. Is this what you expect?

Leave a Reply