-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Open
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/table
Description
Description
I tried to put two tables in one component with different data sources which worked well with the data rending part. However, the paginator didn't work on the second table.
Reproduction
Please use StackBlitz to check the issue:
StackBlitz Project Editor link: https://stackblitz.com/edit/angular-brxwzo
StackBlitz Output link: https://angular-brxwzo.stackblitz.io
Steps to reproduce:
- Create two table
- Create two data sources with different numbers of elements into it.
- Bind the data source with the respective data source for eg.
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA); dataSource1 = new MatTableDataSource<PeriodicElement>(myData);
Table 1
<table mat-table [dataSource]="dataSource">
Table 2
<table mat-table [dataSource]="dataSource1">
- Create the paginator for the following datasouces:
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; @ViewChild(MatPaginator, {static: true}) paginator2: MatPaginator;
- Only the first paginator will work in the output.
Expected Behavior
Like the first table pagination, the second table pagination should also work independently to the first as the data sources are different, the paginator pointing instance is different.
Actual Behavior
Only the first table pagination is working rest of all other table pagination are begin ignored.
Environment
- Angular: 9.0.5
- CDK/Material: 9.2.4
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu 20.01
Prajwal-Pandit, jlmansillaunlam, enricobenedos, info1922, ergauravsharma and 2 more
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/table