DataTable row editing how to allow only one row edit at a time

UI Components for Angular
Post Reply
vn16667
Posts: 2
Joined: 21 Apr 2020, 08:05

21 Apr 2020, 08:11

Hello,

I am using DataTable row editing :

<p-table [value]="cars2" dataKey="vin" editMode="row">

How can I allow only one row edit at a time ?

Best Regards.

User avatar
acsiseci
Posts: 3
Joined: 27 Sep 2020, 12:03
Contact:

18 Jun 2021, 10:05

component.html

Code: Select all


<button
                        *ngIf="!editing"
                        pButton
                        pRipple
                        type="button"
                        pInitEditableRow
                        icon="pi pi-pencil"
                        (click)="onRowEditInit(data)"
                        class="p-button-rounded p-button-text"
                    ></button>



component.ts

Code: Select all

export class Component implements OnInit {
   
    @ViewChild(Table) private dataTable: Table;
    constructor(){}

Code: Select all

public onRowEditInit(data:DataModel) {
        this.dataTable.editingRowKeys = {[data.id]:true}
    }


Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 5 guests