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

Checked parent - unchecked child doesn't behave correctly for decoupleChildFromParent = true

Open tschmidt01 opened this issue 7 years ago • 8 comments

data structure:

itCategory = [new TreeviewItem({
    text: 'IT', value: 9, checked: true, children: [
      {
        text: 'Programming', value: 91, children: [], checked: false
      }
    ]
  })];

config:

    this.ngxTreeviewConfig = {
      hasAllCheckBox: false,
      hasFilter: false,
      hasCollapseExpand: true,
      decoupleChildFromParent: true,
      maxHeight: 600
    };

view:

<ngx-treeview [config]="ngxTreeviewConfig" [items]="itCategory" (selectedChange)="onSelectedChange($event)"></ngx-treeview>

results in: screen shot 2017-12-13 at 17 28 12

should result in: screen shot 2017-12-13 at 17 30 00

tschmidt01 avatar Dec 13 '17 16:12 tschmidt01

I am also facing same issue. any Solution around ?

jenkyjeni avatar Jun 01 '18 03:06 jenkyjeni

Yes, when using decoupleChildFromParent =true, any changes from parent will not reflect to children. Please change decoupleChildFromParent =false

leovo2708 avatar Jun 01 '18 03:06 leovo2708

In my case, i need to check the parent by default when there is not child selected

jenkyjeni avatar Jun 01 '18 05:06 jenkyjeni

I have the same issue, any response?

cjosue15 avatar Jul 04 '20 03:07 cjosue15

I am upgrading to Angular 10. When completed, I will verify your issue.

leovo2708 avatar Jul 04 '20 03:07 leovo2708

Thanks a lot, ngx-trevieew is very useful

cjosue15 avatar Jul 05 '20 01:07 cjosue15

itCategory = [new TreeviewItem({
    text: 'IT', value: 9, checked: true, children: [
      {
        text: 'Programming', value: 91, children: [], checked: false
      }
    ]
  })];

Why we need parent node is checked while child nodes are unchecked? ngx-treeview will correct states of nodes before rendering. So, you will see the parent node is unchecked although you set it is checked.

leovo2708 avatar Jul 06 '20 09:07 leovo2708

@leovo2708 as you're asking, so what is the purpose of decoupleChildFromParent ?

Use cases may change as per the user needs. It'd be great if you give the option to change that too. Thanks in advance.

silambarasan-r avatar Dec 31 '20 06:12 silambarasan-r