The data can be viewed in table format in online mode at any time. But, there is a need of data in an offline mode. Also in many cases, we need to take huge data reports from the website. PrimeNG DataTable can be exported in CSV format using the exportCSV() API method. Button components placed inside or outside of the table can trigger this method for downloading the data in the CSV format. The component with export API method call would be written as follows:
<p-dataTable #dt [value]="basicBrowsers" exportFilename="browsers"
csvSeparator=";">
<p-header>
<div class="ui-helper-clearfix">
<button type="button" pButton icon="fa-file-o" iconPos="left"
label="CSV" (click)="dt.exportCSV()" style="float:left"></button>
</div>
</p-header>
<p-column field="engine" header="Engine">...