How can I start row edit mode on a new form control in a primeng table?

Discussão em 'Angular' iniciado por dmance, Março 7, 2025.

  1. dmance

    dmance Guest

    I have a primeng table that takes data from a form array.

    I want to start row edit mode on a new form control of that form array programmatically.

    I've been trying using this function but I do not know how to use it properly:

    table.initRowEdit();

    public addNewElement(): void {
    const newFormGroup = new FormGroup({
    code: new FormControl(null),
    type: new FormControl(null),
    });
    this.formArray.insert(0, newFormGroup);
    this.table.initRowEdit(this.formArray.controls[0]);
    }


    If I click in the template button annotated with: pInitEditableRow it works as expected. But I want to add a new row and start editing it without having to click in any button.

    Continue reading...

Compartilhe esta Página