Treeview onSelect event and Grid

2 posts, 0 answers
  1. Robert Madrian
    Robert Madrian avatar
    168 posts
    Member since:
    Apr 2003

    Posted 06 Jan Link to this post


    I have a treeview and a grid where the select node id is used in the Data Event from the grid to filter the data based on the treeview selection.

    function onMitglieddokumente_DataFilter() {
        var treeView = $("#tvwDokumentenablagestruktur").data("kendoTreeView");
        var selectedNode =;
        var id = 1;       
        if (selectedNode.length != 0) {
            var item = treeView.dataItem(selectedNode);
            id =;                  
        return {
            mitgliedid: @ViewContext.RouteData.Values["mitgliedid"],
            ordnerid: id


    in the Treeview onSelect Event I refresh the grid datasource:

    function onTreeviewChange(e) {


    the Problem with that solution is, that I always get the latest selection of the Treeview not the current one!

    if I use the onChange Event the refresh is fired more than ones because it fires on selection and on expand...



  2. Alex Gyoshev
    Alex Gyoshev avatar
    2515 posts

    Posted 09 Jan Link to this post

    Hello Robert,

    The TreeView select event is triggered before the selection is updated, to allow the event to be prevented. To resolve the problem, you can use one of these approaches:

    • use a setTimeout in the select event handler

      function onTreeviewChange(e) {
          setTimeout(function() {
    • pass the selected item id to the datasource fetch method.

          id: this.dataItem(e.node),
          mitgliedid: @ViewContext.RouteData.Values["mitgliedid"]
    Alex Gyoshev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top