ng-csv
ng-csv copied to clipboard
export more than 1 files on single click
Hi,
it's possible export more csvs on one click. I need export data from child's table and also need to export parent's table in the same time. Is it possible? Thanks for your answer.
I had a similar requirement to download a master and child table's data in 2 separate csv's. So below is an example how I did it. Using AngularJs. It can be done with simple javascript also.
<img id="masterReportDownload" title="Download as CSV file" alt="Download as CSV file" ng-src="{{downloadImage}}" ng-csv="getExportData()" csv-header="getExportDataHeader()" filename="{{exportFilename}}">
<img id="childReportDownload" title="Download as CSV file" alt="Download as CSV file" ng-src="{{downloadImage}}" ng-csv="getExportChildData()" csv-header="getExportChildDataHeader()" filename="{{exportChildFilename}}">
$scope.getExportData = function(data) {
var arr = [];
...
$timeout(function() {
angular.element('#childReportDownload').triggerHandler('click');
}, 50);
...
}