Angular - Kendo treeview checkbox change event firing multiple times

2 posts, 0 answers
  1. Abhinandan
    Abhinandan avatar
    1 posts
    Member since:
    Feb 2014

    Posted 03 Mar 2014 Link to this post


    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);
    });
    };
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 04 Mar 2014 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top