This is a migrated thread and some comments may be shown as answers.

TreeView - checkBy bind to dataItem

4 Answers 424 Views
General Discussions TreeView
This is a migrated thread and some comments may be shown as answers.
Santo
Top achievements
Rank 1
Santo asked on 17 Jan 2018, 07:18 AM

Hi,

Is it possible to bind to the dataItem itself and get that returned to our checkedKeys variable?

 

Best Regards,

Santo.

4 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 17 Jan 2018, 08:06 AM
Hi Santo,

Yes, absolutely. You can define a specific `checkBy` function that will return the item itself as checked key.

https://www.telerik.com/kendo-angular-ui-develop/components/treeview/api/CheckDirective/#toc-checkby

Here is the concrete example using a custom checkBy callback:

https://plnkr.co/edit/UYJ29ZeJDeSUYd83HMBw?p=preview

If you need even more fine-grain control over the check functionality then you can always define a custom CheckDirective where the `isChecked` and `checkedChange` properties are defined accordingly. A complete custom implementation can be found in our documentation:

https://www.telerik.com/kendo-angular-ui-develop/components/treeview/checkboxes/#toc-modifying-the-checked-state

Regards,
Georgi Krustev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Santo
Top achievements
Rank 1
answered on 17 Jan 2018, 09:52 PM

Hi Georgi,

Thank you! That was very helpful.

Best Regards.
Salman Khalid.

0
Mark
Top achievements
Rank 1
Veteran
Iron
answered on 04 Jun 2020, 03:25 PM
Would be nice to have the example running.
0
Svet
Telerik team
answered on 08 Jun 2020, 09:58 AM

Hi Mark,

Here is an updated example based on StaclBlitz:

https://stackblitz.com/edit/angular-nfuvpz?file=app/app.component.ts

Regards,
Svetlin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Braj
Top achievements
Rank 1
commented on 27 Feb 2023, 09:11 AM | edited

when I am using [checkBy], parent checkbox not checked when I am checked in child item.

In handleChekcing(event)- It returned object which is ok as per my requirement,

but when i remove the [checkBy], parent checkbox checked when i am checked in child item but handleChecking() method returned the array of indexes, while I require objects.  Any help would be appriciated.

 

Martin
Telerik team
commented on 28 Feb 2023, 08:10 AM

Hi Braj,

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

Tags
General Discussions TreeView
Asked by
Santo
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Santo
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Veteran
Iron
Svet
Telerik team
Share this question
or