angular / angular/components

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

Aperta
#15,791 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: material/table P2
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con il metodo connect() di DataSource generato dallo schematic della tabella e con la riproduzione StackBlitz collegata nell'issue. Confronta il flusso statico observableOf(this.data) con il caso richiesto di http.get per async-data; il lavoro è concluso quando l'uso attuale di async nello schematic è documentato chiaramente con un esempio verificabile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
documentation, frontend
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.