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

Angular - Kendo treeview checkbox change event firing multiple times

1 Answer 193 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Abhinandan
Top achievements
Rank 1
Abhinandan asked on 03 Mar 2014, 08:28 PM

http://stackoverflow.com/questions/22156602/angular-kendo-treeview-checkbox-change-event-firing-multiple-times


I am trying to implement the checkbox change event using angular but seeing the event firing multiple times when a checkbox is clicked.I have created a plnkr for this, please help. Ideally it should be fired only once.


$scope.treeOptions = {
checkboxes: {
checkChildren: true
},
dataBound: function(e) {
$scope.attachChangeEvent(e);

}

};Event change code: $scope.attachChangeEvent = function(e) {

var dataSource = e.sender.dataSource;
// issue : change event is getting called multiple times for every click on checkbox
dataSource.bind("change", function(e) {
var selectedNodes = 0;

var checkedNodes = [];

$scope.checkedNodeIds(dataSource.view(), checkedNodes);


for (var i = 0; i < checkedNodes.length; i++) {
var nd = checkedNodes[i];
if (nd.checked) {
selectedNodes++;
}
}
// check the console - this is called multiple times for one checkbox click
console.log(selectedNodes);
});
};

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 Mar 2014, 08:55 AM
Hi,

We recommend opening a new github issue for the angular-kendo project.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Hierarchical Data Source
Asked by
Abhinandan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or