Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree: Update filtered nodes on nodes value changes #15397

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/app/components/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,9 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo
ngOnChanges(simpleChange: SimpleChanges) {
if (simpleChange.value) {
this.updateSerializedValue();
if (this.hasFilterActive()) {
this._filter(this.filterViewChild.nativeElement.value);
}
}
}

Expand Down Expand Up @@ -1395,6 +1398,10 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo
return this.filter && this.filteredNodes && this.filteredNodes.length;
}

hasFilterActive() {
return this.filter && this.filterViewChild?.nativeElement?.value.length > 0
}

getNodeWithKey(key: string, nodes: TreeNode<any>[]): TreeNode<any> | undefined {
for (let node of nodes) {
if (node.key === key) {
Expand Down
Loading