Angular Material editable table using FormArray

后端 未结 5 1780
不思量自难忘°
不思量自难忘° 2020-12-14 17:17

I\'m trying to build an inline editable table using the latest material+cdk for angular.

Question

How can I make mat-table use [formG

5条回答
  •  半阙折子戏
    2020-12-14 17:32

    Create a function that calculates the actual index.

    getActualIndex(index : number)    {
        return index + pageSize * pageIndex;
    }
    

    You can get the pageSize and pageIndex from the paginator. Then, in the template use this function:

    formControlName="getActualIndex(index)"
    

提交回复
热议问题