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

setDataSource method not found on TreeView widget

0 Answers 103 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Joshua asked on 11 Oct 2012, 08:28 PM
Hello all,

I've been trying to create a tree-view widget using MVVM, declartive initialization and a remote Hierarchical data source.  However, kendo.web is throwing a javascript error when attempting to call widget.setDataSource(source) on line #8126 of kendo.web.js (version 2012.2.710). This is in the binders.widget.source.refresh() method.

I'm confused, because looking through the JavaScript code for the TreeView widget, I see comments that say essentially that remote data sources are not supported for the TreeView widget, but various examples on the Kendo UI website show remote data being used with the HierarchicalDataSource, which in turn is used with the TreeView widget.

Does anyone have any ideas on what I might be doing wrong?  I know that the binding is partially working because one of the other controls on the page is getting wired-up to its corresponding function on the viewModel.

Here is my markup...
<div id="dlsAdmin">
    <select id="Mode" name="Mode" data-bind="events: { change: ChangeMode }">
        <option value="Maintenance">Maintenance</option>
        <option value="Reporting">Reporting</option>
    <div id="customerTree"
        data-bind="source: TreeViewDataSource, value: SelectedNode"
        data-checkboxes="{ checkChildren: true }"

Here is my ViewModel

// Generated by CoffeeScript 1.3.3
(function() {
  var root;
  root = typeof window !== "undefined" && window !== null ? window : global;
  root.DLSAdminManager = (function() {
    function DLSAdminManager(treeViewUrl) {
      var dataSource;
      this.SelectedNode = {};
      dataSource = {
        transport: {
          read: {
            url: treeViewUrl,
            dataType: 'json'
        schema: {
          model: {
            id: 'id',
            hasChildren: 'hasChildren'
      this.TreeViewDataSource = new;
    DLSAdminManager.prototype.ChangeMode = function() {
      return alert('change mode!');
    return DLSAdminManager;

and here is my initialization code

$(function() {
    var adminManager = kendo.observable(new DLSAdminManager('/Admin/GetAccountHierarchy'));
    kendo.bind('#dlsAdmin', adminManager);

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question