当我导出一个没有数据列的数据表时,我得到了#34; undefined"在专栏中。所以我想在列中什么都没有,我该如何设置数据表组件?
export class DataTableExportDemo implements OnInit {
cars: Car[];
selectedCars: Car[];
constructor(private carService: CarService) { }
ngOnInit() {
this.carService.getCarsSmall().then(cars => this.cars = cars);
}
}

<p-dataTable #dt [value]="cars" exportFilename="cars" [(selection)]="selectedCars" selectionMode="multiple" [metaKeySelection]="false">
<p-header>
<div class="ui-helper-clearfix">
<button type="button" pButton icon="fa-file-o" iconPos="left" label="All Data" (click)="dt.exportCSV()" style="float:left"></button>
<button type="button" pButton icon="fa-file" iconPos="left" label="Selection Only" (click)="dt.exportCSV({selectionOnly:true})" style="float:right"></button>
</div>
</p-header>
<p-column field="vin" header="Vin"></p-column>
<p-column field="year" header="Year"></p-column>
<p-column field="brand" header="Brand"></p-column>
<p-column field="color" header="Color"></p-column>
</p-dataTable>
&#13;
例如,当年份列中没有数据的结果列表时,我将数据表导出到excel文件中,我得到&#34; undefined&#34;在年份列中。如何在年份栏中得到任何内容。