Search code examples
kendo-uiteleriktreelistkendo-treelist

kendo Treelist keeps telling no records to Display


I´m intending to use some kendo controls from telerik and I started playing with the Treelist control. I´m doing this with Visual Studio 2013 VB or C#.

The plan is to create a webservice that sends some (serialized) data and the user has to manually press a button which is linked to a $Ajax request that POSTS for the data. That data should be passed to the treelist.

But whatever I try it keeps telling me: No Records to Display

Questions:

1 Why is the sample I provided not working. I copied almost literally one of the demo´s.

2 Do you need a seprate datasource or can you put the data direct in the treelist as well?

Thanks in advance.

Rick (NL)

Sample:

`<script type="text/javascript">
 $(document).ready(function () {
      var dataSource = new kendo.data.TreeListDataSource({
         data: [
             { "Item": "Item0", "id": 0, "ParentId": null },
             { "Item": "Item1", "id": 1, "ParentId": 0 },
             { "Item": "Item2", "id": 2, "ParentId": 1 },
             { "Item": "Item3", "id": 3, "ParentId": 1 },
             { "Item": "Item4", "id": 4, "ParentId": null },
             { "Item": "Item5", "id": 5, "ParentId": null },
             { "Item": "Item6", "id": 6, "ParentId": 5 },
             { "Item": "Item7", "id": 7, "ParentId": 5 },
             { "Item": "Item8", "id": 8, "ParentId": 7 },
             { "Item": "Item9", "id": 9, "ParentId": 7 }
         ],
         schema: {
             model: {
                 id: "id",
                 expanded: true
             }
         }
     });

     $("#treelist").kendoTreeList({
         dataSource: dataSource,
         height: 540,
         columns: [
             { field: "Item" },
             { field: "id" },
             { field: "ParentId" }
         ]
     });
 });

</script>

Solution

  • This is down to a simple typo the "ParentId" needs to be parentId (note lowercase p).

    see this dojo for a working version.

    http://dojo.telerik.com/uWaSO

    I've fallen foul of this before.