ngx-treeview icon indicating copy to clipboard operation
ngx-treeview copied to clipboard

Parent nodes are not partially checked when child found by filter is selected

Open DmitriKurochkin opened this issue 5 years ago • 1 comments

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:

  1. Uncheck all selected items.
  2. Do search by 'Angular 2'
  3. Select 'Angular 2' child item
  4. Clear filter by selecting 'Angular 2' text and clicking on backspace or del button.
  5. 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.

ngx-treeview - Google Chrome 2019-09-12 11 46 28

DmitriKurochkin avatar Sep 12 '19 08:09 DmitriKurochkin

use this function in ts file your problem get resolve. vegetableCategory.correctChecked();

TejasRadical avatar Oct 04 '19 06:10 TejasRadical