angular / angular/components

schematic(table): using generated DataSource with async data source

Offen
#15,791 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/table P2
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### What 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:
```ts
connect(): Observable {
// 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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der generierten DataSource-connect()-Methode des Tabellen-Schematics und der im Issue verlinkten StackBlitz-Reproduktion. Vergleiche den statischen observableOf(this.data)-Ablauf mit dem angeforderten http.get-Fall für async-data; abgeschlossen ist die Aufgabe, wenn die aktuelle async-Nutzung des Schematics mit einem überprüfbaren Beispiel klar dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
documentation, frontend
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.