ngx-treeview
ngx-treeview copied to clipboard
Checked parent - unchecked child doesn't behave correctly for decoupleChildFromParent = true
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:
should result in:
I am also facing same issue. any Solution around ?
Yes, when using decoupleChildFromParent =true, any changes from parent will not reflect to children. Please change decoupleChildFromParent =false
In my case, i need to check the parent by default when there is not child selected
I have the same issue, any response?
I am upgrading to Angular 10. When completed, I will verify your issue.
Thanks a lot, ngx-trevieew is very useful
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
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.