title: Uncaught TypeError: Cannot read property 'dataSource' of undefined
body: <p>I'm trying to get the KendoTree view working with checkbox options. I have copied the exact same code and added:</p>
  
  <pre><code>&lt;link href="kendo/kendo.common.min.css" rel="stylesheet" /&gt;
  &lt;link href="kendo/kendo.default.min.css" rel="stylesheet" /&gt;
  &lt;script src="kendo/jquery.min.js" /&gt;
  &lt;script src="kendo/kendo.all.min.js" /&gt;
  
  &lt;script&gt;
      $("#treeview").kendoTreeView({
          checkboxes: {
              checkChildren: true
          },
  
          dataSource: [{
              id: 1, text: "My Documents", expanded: true, spriteCssClass: "rootfolder", items: [
                  {
                      id: 2, text: "Kendo UI Project", expanded: true, spriteCssClass: "folder", items: [
                          { id: 3, text: "about.html", spriteCssClass: "html" },
                          { id: 4, text: "index.html", spriteCssClass: "html" },
                          { id: 5, text: "logo.png", spriteCssClass: "image" }
                      ]
                  },
                  {
                      id: 6, text: "New Web Site", expanded: true, spriteCssClass: "folder", items: [
                          { id: 7, text: "mockup.jpg", spriteCssClass: "image" },
                          { id: 8, text: "Research.pdf", spriteCssClass: "pdf" },
                      ]
                  },
                  {
                      id: 9, text: "Reports", expanded: true, spriteCssClass: "folder", items: [
                          { id: 10, text: "February.pdf", spriteCssClass: "pdf" },
                          { id: 11, text: "March.pdf", spriteCssClass: "pdf" },
                          { id: 12, text: "April.pdf", spriteCssClass: "pdf" }
                      ]
                  }
              ]
          }]
      });
  
      // function that gathers IDs of checked nodes
      function checkedNodeIds(nodes, checkedNodes) {
          for (var i = 0; i &lt; nodes.length; i++) {
              if (nodes[i].checked) {
                  checkedNodes.push(nodes[i].id);
              }
  
              if (nodes[i].hasChildren) {
                  checkedNodeIds(nodes[i].children.view(), checkedNodes);
              }
          }
      }
  
      // show checked node IDs on datasource change
      $("#treeview").data("kendoTreeView").dataSource.bind("change", function() {
          var checkedNodes = [],
              treeView = $("#treeview").data("kendoTreeView"),
              message;
  
          checkedNodeIds(treeView.dataSource.view(), checkedNodes);
  
          if (checkedNodes.length &gt; 0) {
              message = "IDs of checked nodes: " + checkedNodes.join(",");
          } else {
              message = "No nodes checked.";
          }
  
          $("#result").html(message);
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>It is giving me -</p>
  
  <p>Uncaught TypeError: Cannot read property 'dataSource' of undefined.</p>
  
  <p>Any help would be great.</p>
  
  <p>Thanks.
  Sonu</p>