PrimeNG V15 exit edit mode of a CellEditing table

576 Views Asked by At

I have a PrimeNG table

<p-table [value]="products" dataKey="name" (onEditInit)="onEditInit($event)"   (onEditComplete)="onEditComplete($event)"   (onEditCancel)="onEditCancel($event)"
>

and I am using the CellEdiding Function

<tr>
      <td
        [pEditableColumn]="product.name"
        [pEditableColumnField]="product.comment"
        [pEditableColumnRowIndex]="product.id"
      >

I can exit from the editing mode by typing "enter" or "escape" on the keyboard. Is there any way to do it by clicking on a button ?

Exemple available here

1

There are 1 best solutions below

0
user2452092 On

See : Switch p-table cell programmatically to edit mode in Primeng

and use :

setTimeout(() => {
     this.editableColumn.closeEditingCell();
}, 0);