My HTML page has 2 tables and both of them has different column names. My first table has column as Application ID
and Application Type
where as my second table has columns File Name
and Checkbox s
(to select and delete file). For this scenario I have to use PrimeNg data table i.e. <p-dataTable>
. Can I customize the data table column names? Please guide me how to achieve this?
So far what i did is:
table.ts as below
folderData = FolderData[];
(model) FolderData.ts as below
appID: string;
appType: string;
filename: string;
checkBox: boolean;
table.html as below
**First Data Table**
<p-dataTable [value]="folderData ">
<p-header [style]="{'width': '100%'}">
<div class="ui-helper-clearfix">
Big Table
</div>
</p-header>
<p-column field="Col1" header="Application ID" [sortable]="true" [style]="{'width': '200px'}"></p-column>
<p-column field="Col2" header="Application Name" [sortable]="true" [style]="{'width': '200px'}"></p-column>
</p-dataTable>
**Second Data Table**
<p-dataTable [value]="folderData ">
<p-header [style]="{'width': '100%'}">
<div class="ui-helper-clearfix">
Big Table
</div>
</p-header>
<p-column field="Col1" header="File Name" [sortable]="true" [style]="{'width': '200px'}"></p-column>
<p-column field="Col2" header="" [sortable]="true" [style]="{'width': '200px'}"><input type="checkbox"></p-column>
</p-dataTable>
I am not able to figure out how to customize the column names so I have har codded them. Please guide.