ngx-treeview
ngx-treeview copied to clipboard
Parent nodes are not partially checked when child found by filter is selected
Hi, it seems like there is an issue when filter text is changed. Hierarchy tree is not updated correctly.
Below steps to reproduce in ngx-dropdown-treeview demo(https://leovo2708.github.io/ngx-treeview/#/components): Steps:
- Uncheck all selected items.
- Do search by 'Angular 2'
- Select 'Angular 2' child item
- Clear filter by selecting 'Angular 2' text and clicking on backspace or del button.
- Observe the tree.
Expected result: 'IT', 'Programming' and 'Frontend' items should have 'partially checked'('-') status
Actual result: 'IT', 'Programming' and 'Frontend' items have 'unchecked' status
Notes: if clear filter text 'Angular 2' letter by letter then hierarchy tree is updated correctly. I investigated that this.items in treeview.component.ts are not updated correctly. It looks like we should run correctChecked() for each item in the tree in updateFilterItems() function. As work around in our project we call correctChecked() for all our tree items on filterChange event.
use this function in ts file your problem get resolve. vegetableCategory.correctChecked();