Это окончательное решение, которое у меня было для 1) Отображение кнопок в последнем столбце 2) Редактирование всей строки при нажатии на одну ячейку определенной строки и также 3) длядобавьте выпадающий список в ячейку таблицы данных.
<p-dataTable [value]="tableOne" (onRowClick)="onSelectFeature($event)" [editable]="true">
<p-column field="customer" header="CUSTOMER*" [sortable]="true" [style]="{'width':'15%'}">
<template let-col let-row="rowData" let-index="rowIndex" pTemplate="body">
<span *ngIf="!row.isEditable">{{row.customer}}</span>
<span *ngIf="row.isEditable"><p-dropdown [options]="field_customer" [autoWidth]="false" appendTo="body" [placeholder]="row.customer"></p-dropdown></span>
</template>
</p-column>
<p-column field="notes" header="NOTES">
<template let-col let-row="rowData" let-index="rowIndex" pTemplate="body">
<span *ngIf="!row.isEditable">{{row.notes}}</span>
<span *ngIf="row.isEditable"><input type="text" pInputText [(ngModel)]="row.notes" maxlength="64"></span>
</template>
</p-column>
<p-column>
<template let-row="rowData" let-index="rowIndex" pTemplate="body">
<div class="display" *ngIf="row.isEditable">
<button pButton type="button" class="btn margin-left-3p float-right" label="Save"></button>
<button pButton type="button" class="btn margin-left-3p float-right" label="Cancel"></button>
<button pButton type="button" class="btn float-right" label="Delete"></button>
</div>
</template>
</p-column>
</p-dataTable>
файл component.ts
isEditable:boolean;
ngOnInit(){
this.isEditable=false;
}
constructor(private router: Router,private datePipe: DatePipe){
this.tableOne = [
{customer:'PRODUCT',category:'Product', featureName:'OSS', devEstimate:'$12345.00', supportEstimate:'$',started:'TRUE',release:'SAIL 2.28',notes:'Funded by IMS'},
{customer:'TECHNOLOGY',category:'Product', featureName:'QWE', devEstimate:'$12345.00', supportEstimate:'$',started:'TRUE',release:'SAIL 2.28',notes:'Funded by IMS'}];
}
onSelectFeature(e)
{
this.CloseAllEditable(this.tableOne);
this.CloseAllEditable(this.tableTwo);
e.data.isEditable=true;
}
CloseAllEditable(data){
for(let item of data)
{
if(item.isEditable)
{
item.isEditable = false;
}
}
}