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

problem with loading data in KendoTreeView

2 Answers 296 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
karyjon
Top achievements
Rank 1
karyjon asked on 22 Oct 2012, 07:14 AM
hi
My Data doesn't load in tree view.

please see my source code first.

Controler:
public JsonResult LoadOrganizationChart([DataSourceRequest] DataSourceRequest request)
        {
            var employee = EmployeSystemEntityOperator.GetEntityListOf<OrganizationChart>();
            DataSourceResult result = employee.ToDataSourceResult(request);
            return Json(result,JsonRequestBehavior.AllowGet);
        }

View:
@using Kendo.Mvc.UI
@model IEnumerable<Ets.Data.EmployeeSystem.OrganizationChart>
 
@(Html.Kendo().TreeView().Name("treeview")
      .DataTextField("NodeName")
      .DataSource(dataSource => dataSource.Read(read => read.Action("LoadOrganizationChart", "OrganizationChart")))
      )

i trace the result with firebug and attach the image.
i see my data in Firebug --> Net -->XHR --> Json
but my data don't show in tree view.
Any One?? Any Idea???

2 Answers, 1 is accepted

Sort by
0
Greg
Top achievements
Rank 1
answered on 21 Nov 2012, 12:57 AM
Karyjon
have a look at

treeview and checkboxes: a Solution

http://www.kendoui.com/forums/mvc/treeview/treeview-and-checkboxes-a-solution.aspx

it may point you in the right direction, especially with the controller method; I think you may be missing the 'Select' part of the L2E query
0
Hari
Top achievements
Rank 1
answered on 10 Dec 2012, 05:19 PM
Hi karyjon,
We are stuck with the same situation. Can you help us?

I am trying to convert my sample XML file as JSON object and set that as a datasource to my tree view control. Its not working. I am sure that I am missing something here but not sure what's that. Please help me.

 Here is my code in Controller class where I am loading the XML file and retruning as JSON

        public JsonResult Employees()
        {

            XElement xdoc = XElement.Load("C:\\Users\\a409114\\Desktop\\TreeView.xml");
            return Json(xdoc, JsonRequestBehavior.AllowGet);
        }

Here is my code in the view file where I am invoking the action name "Employees" in my controller class "TreeViewController".

<div class="demo-section">
@(Html.Kendo().TreeView()
    .Name("treeview")
     .DataTextField("vehicles")
    .DataSource(dataSource => dataSource
        .Read(read => read
            .Action("Employees", "TreeView")
        )
    )
)
</div>

<style scoped>
.demo-section {
    width: 200px;
}
</style>

Here is my sameple XML file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tree>
<vehicles>
    <car>FM-1100</car>
    <car>FM-4200</car>
    <bike>FM-3100</bike>
</vehicles>
<personnel>
    <client>GH-3000</client>
    <vip>GH-3100</vip>
</personnel>
</tree>

This is not loding the Tree View Control!


Tags
TreeView
Asked by
karyjon
Top achievements
Rank 1
Answers by
Greg
Top achievements
Rank 1
Hari
Top achievements
Rank 1
Share this question
or