The Tree View component is incredibly frustrating to work with.
How do I establish an indeterminate check box?
Here is my TreeView and below is my isChecked method.
I have attached a snagit capture of the problem I'm having.
<
kendo-treeview
#actionPermissions
[nodes]="treeNodes"
kendoTreeViewCheckable
[hasChildren]="hasChildren"
textField
=
"displayName"
childrenField
=
"children"
[(checkedKeys)]="checkedKeys"
[isChecked]="isChecked"
kendoTreeViewHierarchyBinding
kendoTreeViewExpandable
[(expandedKeys)]="expandedKeys"
(checkedChange)="handleChecking($event)">
public
isChecked = (dataItem: NcActionDto): CheckedState => {
let checkedNode = _.find(
this
.checkedKeys, m => m === dataItem.id);
if
(checkedNode) {
if
(dataItem.children.length > 0) {
dataItem.children.forEach((item) => {
if
(!_.find(
this
.checkedKeys, m => m === item.id)) {
return
'indeterminate'
;
}
});
}
else
{
return
'checked'
;
}
}
else
{
return
'none'
;
}
}
I have to say I am a member of many forums and this is without doubt the worst of all for posting information. It's ancient and every difficult to work with.