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

call a function on node checked event

1 Answer 146 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 2
John asked on 29 Jun 2014, 08:19 PM
I would like to call a JavaScript function when a nodes' checkbox is clicked so that I can update anther control on screen. There is not a "OnChecked" event, so is it possible ?

Any help appreciated,
John

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 30 Jun 2014, 09:00 AM
Hello John,


Indeed there is no built in onChecked event. Since the checked state of the items is stored in the dataSource, you could bind to it's change event to handle the checking (unchecking) of the items.
E.g.
$(function () {
    var treeview = $("#treeview").data("kendoTreeView");
    treeview.dataSource.bind("change", function (e) {
        if (e.field == "checked") {
            //an item was checked/unchecked
        }
    });
});

I hope this information helps.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
John
Top achievements
Rank 2
Answers by
Dimiter Madjarov
Telerik team
Share this question
or