ng-csv icon indicating copy to clipboard operation
ng-csv copied to clipboard

export more than 1 files on single click

Open pinderko opened this issue 9 years ago • 1 comments

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.

pinderko avatar Dec 15 '15 12:12 pinderko

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);
    ...

}

abhisheksimion avatar Apr 26 '16 12:04 abhisheksimion