Angular + Material - How to refresh a data source (mat-table)

前端 未结 23 1401
自闭症患者
自闭症患者 2020-11-28 01:59

I am using a mat-table to list the content of the users chosen languages. They can also add new languages using dialog panel. After they added a language and returned back.

23条回答
  •  伪装坚强ぢ
    2020-11-28 02:39

    Since you are using MatPaginator, you just need to do any change to paginator, this triggers data reload.

    Simple trick:

    this.paginator._changePageSize(this.paginator.pageSize); 
    

    This updates the page size to the current page size, so basically nothing changes, except the private _emitPageEvent() function is called too, triggeing table reload.

提交回复
热议问题