jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Export multiple jqxgrids to excel on single button click
This topic contains 5 replies, has 2 voices, and was last updated by Dimitar 11 years, 11 months ago.
-
Author
-
How to export multiple Jqxgrids to single excel sheet on single button click?
I am able to export individual jqxgrid to excel using the following function:
$("#excelExport").click(function () { $("#jqxgrid").jqxGrid('exportdata', 'xls', 'jqxGrid'); });
But as this is not useful to me, please let me know whether is it possible to export multiple jqxgrids from a jsp page to excel on single button click.
Kindly reply,
Thank You,
Hello Akshatha Raju,
Unfortunately, multiple grids cannot be exported to a single Excel spreadsheet. As for exporting them on a single button click, just call all grids’ export methods in the click event function.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you for the reply!!
How will I export multiple jqxgrids from a single jsp page to excel on a single button click,
If I call all the grids in the same click function,
by appending all the grid ID’s in the same function like following, it neither works or gives an error,,
$(“#excelExport”).click(function () {
$(“#jqxgrid1”, “#jqxgrid2”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);
});Or,
If I call them separately as follows, I will get only the first grid in excel:$(“#excelExport”).click(function () {
$(“#jqxgrid1”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);$(“#jqxgrid2”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);
});Hi
You would have to set a time out to export both grids, i.e.:
$("#excelExport").click(function () { $("#jqxgrid1").jqxGrid('exportdata', 'xls', 'jqxGrid', false); setTimeout(function () { $("#jqxgrid2").jqxGrid('exportdata', 'xls', 'jqxGrid', false); }, 1500);});
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi,
did u mean using setTimeout function, both grids will be exported to same excel on single button click?
I get only the first grid in Excel even after using setTimeout function !!,
Hi Akshatha Raju,
This workaround is for exporting two grids to different files with a single click.
On a side note, you may export both grids to variables and then merge the data as you like.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.