Generate TreeView DataSource in Jquery

1 posts, 0 answers
  1. Atul
    Atul avatar
    3 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post

    Hello,

    I am using KendoUi TreeView, as I read this treeview doesn't support remote data source from Json. So I was trying to take data from controller in Jquery and loop it to create treeview item as below

    $.getJSON(baseurl +
    '/api/TreeDataController/GetOnlineTreeData',

     function (data) {
     var ds;
                      ds = {
      $.each(data, function (i, row) {
                       id: data[i].id, text: data[i].Name, items: [{ id: data[i].id, text: "<label>" + data[i].Name + "</label>" }]
           });
                      }

              var treeview = $("#treeview").kendoTreeView({

                     template: kendo.template($("#treeview-template").html()),

                     dataSource:[ds]

                     }).data("kendoTreeView")

    });

    But here I am getting error at text:  (saying expected ; ). So please give me solution how can I show this data as datasource for Tree.

    Thanks,
    Atul

Back to Top