tree view parent checkbox not coming checked when checked in child checkbox

1 Answer 560 Views
TreeView
Braj
Top achievements
Rank 1
Braj asked on 27 Feb 2023, 01:07 PM | edited on 27 Feb 2023, 01:14 PM

I have three layer object: there is several departments, Department have multiple categories and category have multiple subCategories:

I am using [checkBy]="checkBy" in html page

Html code of tree view:

 [nodes]="refinedProducts"
                [children]="children"
                [hasChildren]="hasChildren"
                [textField]="['Department', 'Category', 'SubCategory']"
                [checkedKeys]="checkedKeys"
                (valueChange)="handleProductChecking($event)"
                [checkBy]="checkBy"

 

and methods in ts file

public checkBy(item: TreeItem) {

     return item.dataItem;     

}  

public handleProductChecking(checkedKeys: any): void {

//checkedKeys coming as object - that as per my requirement

}

 

 

if I removed the [checkBy]="checkBy"

from html than parent coming checked when i checking any child item but handleProductChecking

returns the array of indexes like [0_1_2] while I need object for my requirement, 

conclusion of my requiremnt is - parent should be checked(with hypen) when I checked in any child and handleProductChecking

return the object rather than array of indexes.

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Bechev
Telerik team
answered on 02 Mar 2023, 07:58 AM

Hi Braj,

Thank you for the provided details.

I noticed that the same question was asked in this forum thread here.

https://www.telerik.com/forums/treeview---checkby-bind-to-dataitem#5120932

But I will paste it here as well:

 

"If an item field or a callback function has been used, the indeterminate state will not be displayed. For more details please check the following article:

https://www.telerik.com/kendo-angular-ui/components/treeview/checkboxes/#toc-multiple-check-by-item-field"

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeView
Asked by
Braj
Top achievements
Rank 1
Answers by
Martin Bechev
Telerik team
Share this question
or