[FIXED] PrimgNg Tree, fill filter input when using _filter method

Issue

I’m using PrimeNg with my Angular 12 project and recently started using a Tree component
https://www.primefaces.org/primeng/showcase/#/tree

The problem is the filter input not being filled when I use the _filter() method although the filter works well but the filter input is empty. This causes a problem, in case that I want to cancel the filtering, I have to type anything in the filter input and clear it again plus the user might not recognize that the tree is filtered.
Is there any solution or workaround to solve this problem

Solution

I’ve accessed the input element by its class name and set the value manually after applying the filter.

const elements = this.elem.nativeElement.querySelectorAll('.p-tree-filter'); elements[0].value = this.filterValue;

Answered By – Islam Mohamed

Answer Checked By – Katrina (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published