Components: bug(data-table): data source connect not called when using router

Created on 8 Jul 2017  路  9Comments  路  Source: angular/components

Bug, feature request, or proposal:

I have copied the exact demo from 'material-examples' into a plunker and have loaded the TableBasicExample component via a router. When navigating to the router (via button in toolbar on plunkr), the table does not display correctly. When clicking that button again, it works. In my own application I have tested by including logging in the connect() method of the data source. It does not get called on initial navigation to the route, but it does when you navigate the second time

One resolution I have used is to perform the dataSource initialization in a setTimeout(1), which solves the issue, but I do not believe that this should be the solution.

What is the expected behavior?

The data source connect method should be called after navigating to page via router

What is the current behavior?

The data source connect method is not called

What are the steps to reproduce?

http://plnkr.co/edit/RRVoUV9SBAxozY6VhvpA?p=preview

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

latest master, and beta8

P3 has pr

Most helpful comment

Same here.

When calling changeDetector.detectChanges after setting the DataSource to manually trigger ChangeDetection the Table will show up.

http://plnkr.co/edit/Soc0n4ak80VKdZ27htVU?p=preview

All 9 comments

same for me

Same here.

When calling changeDetector.detectChanges after setting the DataSource to manually trigger ChangeDetection the Table will show up.

http://plnkr.co/edit/Soc0n4ak80VKdZ27htVU?p=preview

Same here.
The workaround with changeDetector.detectChanges also works for me, but is not satisfying.

Same here

Same for me !

How is this Issue closed?
I mean it does have a workaround that somehow works, but the issue itself is not fixed.
At least the workaround should be mentioned on the documentation.
---- Edit
Ooops its merged, forget it.

Lost so much time figuring this out... =(

I also tried to use snapshot builds but it was not working either.

The detectChanges works but let's hope beta 9 is available with a fix soon :)

I can confirm this hack is not necessary anymore with beta10.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theunreal picture theunreal  路  3Comments

crutchcorn picture crutchcorn  路  3Comments

savaryt picture savaryt  路  3Comments

LoganDupont picture LoganDupont  路  3Comments

jelbourn picture jelbourn  路  3Comments