MatPaginator not working properly on deleting rows from MatTableDataSource

前端 未结 2 1552
小蘑菇
小蘑菇 2021-01-23 15:41

I have created a table with selection and pagination in angular 2 using angular material.

I have taken a button with the name Remove Selected Rows to de

相关标签:
2条回答
  • 2021-01-23 15:57

    It's very simple after close of dialog to subscibe and call listing API

    openDialog(requestId): void {
       //this.abc=requestId;
       const dialogRef = this.dialog.open(DialogOverviewExampleDialog,  {
         disableClose: true,
         width: '400px',
         data: { name: this.name, animal: this.animal, sendtochild: requestId }
       });
    
       dialogRef.afterClosed().subscribe(result => {
         this.getUserList();
       });
    }
    
    0 讨论(0)
  • 2021-01-23 16:01

    Here you go buddy.

    You forgot to reassign the paginator to the datasource after deletion. Angular may do some magic, but sometimes it needs a little bit of help.

    I use a timeout because I always face an issue, feel free to try without it.

    setTimeout(() => {
      this.dataSource.paginator = this.paginator;
    });
    
    0 讨论(0)
提交回复
热议问题