problem with loading data in KendoTreeView

3 posts, 0 answers
  1. karyjon
    karyjon avatar
    6 posts
    Member since:
    Oct 2012

    Posted 22 Oct 2012 Link to this post

    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. Greg
    Greg avatar
    19 posts
    Member since:
    Jun 2012

    Posted 20 Nov 2012 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Hari
    Hari avatar
    10 posts
    Member since:
    Oct 2012

    Posted 10 Dec 2012 Link to this post

    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!


Back to Top