Skip to content

Commit

Permalink
Fixed #10220 - resetFilter for p-tree
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed May 10, 2021
1 parent 358a84a commit d9cd78e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/components/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ export class Tree implements OnInit,AfterContentInit,OnChanges,OnDestroy,Blockab

@ViewChild(CdkVirtualScrollViewport) virtualScrollBody: CdkVirtualScrollViewport;

@ViewChild('filter') filterViewChild: ElementRef;

serializedValue: any[];

headerTemplate: TemplateRef<any>;
Expand Down Expand Up @@ -1209,6 +1211,14 @@ export class Tree implements OnInit,AfterContentInit,OnChanges,OnDestroy,Blockab
});
}

resetFilter() {
this.filteredNodes = null;

if (this.filterViewChild && this.filterViewChild.nativeElement) {
this.filterViewChild.nativeElement.value = '';
}
}

findFilteredNodes(node, paramsWithoutNode) {
if (node) {
let matched = false;
Expand Down
5 changes: 5 additions & 0 deletions src/app/showcase/components/tree/treedemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,11 @@ <h5>Methods</h5>
</tr>
</thead>
<tbody>
<tr>
<td>resetFilter</td>
<td>-</td>
<td>Resets filtering.</td>
</tr>
<tr>
<td>_filter</td>
<td>value: string</td>
Expand Down

0 comments on commit d9cd78e

Please sign in to comment.