-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MatPaginator not working in dynamically generated table. #8705
Comments
Your best bet it to set up a plunker or stackblitz with a working example of your issue and posting it on StackOverflow. We want to keep issues open only for bugs and features |
Same issue here. When pagination data is static, all works, but when this information is updated from a API call, the data is not displayed properly. |
Any update on this? I'm having the same sort of issues. I have search button that pulls back data from an API. Weird thing is that if I select my search button twice, then Pagination and Sort are set correctly. Just don't understand why it's not working on the first search. |
If you open an issue with a link to stackblitz reproducing the issue, we can figure it out. Otherwise it's ambiguous what the trouble is |
Even i am facing same issue for dynamic data. Can anyone give the solution for this bug. |
Why is this issue closed? I have the same problem :( |
Hi guys, I finally figured this out, but it's not the cleanest solution. I was hiding the datatable on load based on an ngif. When that array was loaded then the table would show. At that point if I were to search my service again, then the paginator had a value and worked as expected. So my solution for now is to just show the empty mat-table. That way, pagination works on the first click. The drawback is that an empty table shows on load. |
@CHQ-synaix Unfortunately without a reproduction of the issue, we cannot help to provide guidance. Feel free to add a stackblitz showing your issue and we can see if there's a fix. |
I have solution on that we are placing table with paginators in child component which inits when our data is already loaded (with *ngIf, for example). This way pagination and sorting works properly called in OnInit lifehook |
I even faced the same issue. What I did is to load the table datasource inside onInit, and load the paginator view child inside afterViewInit. Both with checks that the data is available. This way your ngIf works correctly and you don't show an empty table.
Paginator not loading correctly due to a ngIf is a bug that it is being tracked, you can refer this |
just call after table data updated. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I am generating data Dynamically, and displaying it in Data Table, but I`m unable to link MatPaginator with the data table. Data is getting displayed in the table. Following is the sample code snippet (also attaching it ):
I am Able to see the paginator on the UI, but it is totally unresponsive. Following is my sample HTML MatTable code, which displays data in the table:
Following is the array response I receive, which is what I`m trying to display on UI:
Am I missing anything??
The text was updated successfully, but these errors were encountered: