I have a p-table which entails editable columns. What I need to do is when value of a the field Year is changed, I can get and use it. To start, I would like to be able to show it on the console. To do this, I use onEditComplete
funtion
HTML file:
<p-table [columns]="cols" [value]="cars">
<ng-template pTemplate="header" let-columns>
<tr>
<th>ID</th>
<th>Year</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<td pEditableColumn>
<p-cellEditor>
<ng-template pTemplate="input ">
<input type="text" [(ngModel)]="rowData.id">
</ng-template>
<ng-template pTemplate="output">
{{rowData.id}}
</ng-template>
</p-cellEditor>
</td>
<td pEditableColumn [pEditableColumn]="rowData"
[pEditableColumnField]="'year'" (onEditComplete)="onEditComplete(rowData)">
<p-cellEditor>
<ng-template pTemplate="input">
<input type="text" [(ngModel)]="rowData.year" required>
</ng-template>
<ng-template pTemplate="output">
{{rowData.year}}
</ng-template>
</p-cellEditor>
</td>
<td pEditableColumn>
</tr>
</ng-template>
</p-table>
TS file:
onEditComplete (event) {console.log(event);}
But by making changes to the Year field and then pressing tab or enter, I don't get any outputs. Could you help me finding out the problem?