question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:23
  • Comments:9

github_iconTop GitHub Comments

3reactions
xbtequilacommented, Jul 10, 2017

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

2reactions
Toubcommented, Sep 14, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't bind to 'dataSource' since it isn't a known property of 'table'
I am getting an error saying Can't bind to 'dataSource' since it isn't a known property of 'table'. enter image description here. Please...
Read more >
Error when trying to use column based on field using 'SQL ...
Hi, When I attempt to use an 'SQL function' to define a field, it appears to work fine, the value is returned in...
Read more >
Fix list for IBM WebSphere Application Server V8.5
The following is a complete listing of fixes for V8.5 with the most recent fix at the top. Content. Back to all versions ......
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
This tutorial will explain how to avoid this with a special Hook called useEffect , which will run functions only when specific data...
Read more >
Angular Material Data Table: A Complete Example
A complete example of an Angular Material Data Table with server-side pagination, sorting, filtering, as well as a loading indicator.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found