schematic(table): using generated DataSource with async data source
See original GitHub issueWhat is the expected behavior?
Documentation for how to get async data DataSource connect()
from (http.get.....().subscribe()....
)
I don’t ask for example with static data nor old syntax, but how to use with actual schematic for Table and his DataSource
What is the current behavior?
DataSource extension is generated like this:
connect(): Observable<any[]> {
// Combine everything that affects the rendered data into one update
// stream for the data-table to consume.
const dataMutations = [
observableOf(this.data),
this.paginator.page,
this.sort.sortChange
];
// Set the paginator's length
this.paginator.length = this.data.length;
return merge(...dataMutations).pipe(map(() => {
return this.getPagedData(this.getSortedData([...this.data]));
}));
}
No documentation, where and how to call http.get
… for getting async data for connect()
method.
What are the steps to reproduce?
Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV
Try to use material table schematic and fill connect()
not with static data but async call like http.get
…
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Actual angular, actual material 7.3.7, needed typescript
Is there anything else we should know?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
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 >Angular Mat Table with remote source for data - Stack Overflow
I am trying to update the data source, and while the data shows up it doesn't apply any sorting or pagination that has...
Read more >Asynchronous Paging Data Source - Infragistics WPF™ Help
This topic provides instructions on how to create data sources that allow retrieving data from high-latency remote data stores using an asynchronous and ......
Read more >Writing query resolvers | Full-Stack Quickstart - Apollo GraphQL
We've designed our schema and configured our data sources, but our server doesn't know how to use its data sources to populate schema...
Read more >Data Sources Methods - Tableau Help
4, there was no way to append data to an extract with multiple tables using the REST API. Data Sources stored locally. When...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah OK, I see what you mean now.
On the MatTable examples page, the “Table retrieving data through HTTP” example could be helpful. Here’s a Stackblitz link to that example. Note that this example does paging and sorting on the server.
Looking at your
getIOPList(id)
call, it looks like you may be wanting an example that does paging and sorting on the client. Here’s an example that does that:Converting this for your code should look something like this:
Then you will probably want to change your template from
to
Splaktar, I don’t have problem with usage of HttpClient - it works perfectly. I have problem how to connect async data with new/actual version of table schematic.
angular table schematic should not use as a sample static data, but async data.
As an answer to my question should be that I don’t need change connect() method, but I should get async data first and then create DataSource. It is better, but still with some strange errors.
I need fully functional sample with async data, not static. (No, I do not need link for HttpClient!!)
“Old syntax”? Google and look at various versions of usage material table schematic.
Thanks.