You need to sign in to do that
Don't have an account?
Sviatlana Andryianchyk
Alasql excel export just overloads page
Hi,
I am trying to export resurls of my apex function into excel file using alasql library. But this functionality is quite unstable: sometimes it generates file for download, sometimes just overloads page.
This is my VF page:
I am trying to export resurls of my apex function into excel file using alasql library. But this functionality is quite unstable: sometimes it generates file for download, sometimes just overloads page.
This is my VF page:
<script> function exportReport() { Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.AdministrationController.getRemoteAreaData}', chartInterval, function(result, event) { alasql('SELECT * INTO XLS("CallsReport.xls",?) FROM ?', [chartData, result]); }); } //Column header title and field values bind with that header of report var chartData = { headers:true, columns: [ { columnid: 'name', title: 'Date'}, { columnid: 'incoming', title: 'Incoming'}, { columnid: 'outcoming', title: 'Outcoming'}, ], }; </script> <apex:commandButton value="Download Reports" onclick="exportReport();" style="margin-top:15px; width: 100%"/>Here what is happening in the controller:
@RemoteAction global static List<AreaDataWrapper> getRemoteAreaData(String interval) { return CallCenterAdministrationController.generateAreaData(interval); }This function returns list of such objects:
global class AreaDataWrapper { public String name { get; set; } public Decimal incoming { get; set; } public Decimal outcoming { get; set; } public AreaDataWrapper(Decimal incoming, Decimal outcoming, String name) { this.name = name; this.incoming = incoming; this.outcoming = outcoming; } }Thank you in advance