title: KendoUI Treeview Select Node On Databound
body: <p>I have a list view I want the user to be able to double click which will change a treeview's datasource and select a treeview node.  While I get the ID of the item I want to select, execute the code I think should select the node on the treeview, it does not select.  Any thoughts would be appreciated</p>
  
  <p>Listview Double Click Event:</p>
  
  <pre><code>  function setItemDoubleClickEvent() {
       $(".machineInstances").on("dblclick", function () {
        var listView = $("#listView").data("kendoListView");
        var idx = $(this).index();
        var item = listView.dataSource.view()[idx];
        $('#selectedNodeId').val(item.InstanceId);
  
        // Remove the current datasource to remove any existing filtering
        $("#treeview").data("kendoTreeView").setDataSource([]);
  
        // Set the hidden input so OnData knows what to highlight
        $('#selectedNodeId').val(item.InstanceId);
  
        // Set the new datasource for the tree
        $("#treeview").data("kendoTreeView").setDataSource(instanceDataSource);              });
     }
  </code></pre>
  
  <p>TreeView Declaration:</p>
  
  <pre><code>             var treeview = $("#treeview").kendoTreeView({
                      dataTextField: "Name"
                      , select: onSelect,
                      dataBound: ondata
                  }).data("kendoTreeView"),
  </code></pre>
  
  <p>DataBound Function:</p>
  
  <pre><code> function ondata() {
       //alert($('#selectedNodeId').val());
       var selected = $('#selectedNodeId').val();
        if (selected != "") {
  
            var node = treeview.findByUid(selected)
            $("#treeview").data("kendoTreeView").select(node);
            $('#selectedNodeId').val("");
         }
     }
  </code></pre>
  
  <p>Thank you,</p>
  
  <p>Drew</p>