angular / angular/components

Mat-tree :Tree with nested nodes adding child doesnt update the view.

Aperta
#11,381 59 commenti 52 reazioni 0 assegnatari Vedi su GitHub
area: material/tree P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### Bug:

When using mat-nested-tree-node with a nested datasource if you add a child to an existing parent it does not update the view.

#### What is the expected behavior?
Well if you change or add a child to an existing parent in the nestedDataSource it should update the tree.

#### What is the current behavior?
It does not update the view when adding a child to an existing parent to the nestedDataStructure .

#### What is the use-case or motivation for changing an existing behavior?

Well in my case i need to update the view since i add/delete nodes .

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
versions 6 (Chrome ver 66)

#### Is there anything else we should know?
I found an workaround:
refreshTree(){
let _data = this.nestedDataSource.data;
this.nestedDataSource.data = null;
this.nestedDataSource.data = _data;
}

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con mat-nested-tree-node e il percorso di aggiornamento di nestedDataSource descritto nell’issue, riproducendo il problema aggiungendo un figlio a un parent esistente. Confronta la vista con il workaround refreshTree documentato; il lavoro è completato quando l’albero annidato riflette i nodi aggiunti o eliminati senza quel workaround.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.