TreeList load issue

2 posts, 0 answers
  1. Sohel
    Sohel avatar
    4 posts
    Member since:
    Dec 2008

    Posted 05 Jul Link to this post

    Hi,

    I am having issues with loading my treelist. I get "no records to display". What am i doing wrong? Here is my code:

            $(function () {
                hideProgressIndicator();
                $("#treelist").kendoTreeList({
                    resizable: true,
                    selectable: true,
                    columns: [
                      { template: "<input type='checkbox' data-bind='checked: checked' />", width: 60 },
                      { field: "Id", title: "Id", hidden: true },
                      { field: "", title: "", template: "<i class='glyphicon glyphicon-cog' aria-hidden='true'></i> ", hidden: false, width: 60 },
                      { field: "Step", title: "Step", hidden: false, width: 60 },
                      { field: "AssigneeDisplayName", hidden: false, width: 200 },
                      { field: "Description", hidden: false, width: 200 },
                      { field: "Status", hidden: false, width: 80 },
                      { field: "Instructions", hidden: false }
                    ],

                    dataSource: {
                        transport: {
                            read: {
                                url: "@Url.Action("GetAndLockAssignmentList", "AssignmentList", new { area = "Activator", workitemId = ViewBag.WorkitemId })",
                            dataType: "json"
                        }
                    },
                    schema: {
                        model: {
                            id: "Id"
                        }
                    }
                }
                });
            });

    And here is the data being returns for the datasource:

    [{"Id":12414,"Step":1,"AssigneeNodeId":1,"Instructions":null,"Deadline":{"Days":1,"Hours":2,"Minutes":3,"TotalMinutes":603},"DueDate":"\/Date(-62135578800000)\/","Status":0,"IsPinRequired":false,"DistributionType":0,"AssigneeDisplayName":"Default Adminab","Description":"Serial 1","NotifyAssignee":true,"CompletionNotify":true,"IsFyi":false,"SendFyiOnRelease":true,"ChildAssignmentListId":0,"ReleasePaths":"Yes; No; Maybe","ReleaseComment":null,"IsCommentRequired":false,"SelectedReleasePath":null,"DateReleased":null,"NotifyAssigneeTemplate":10,"NotifyAssigneeTemplateDescription":"Offline Copy Arrived","CompletionNotifyTemplate":11,"CompletionNotifyTemplateDescription":"Offline Copy Released","IsOverDue":false,"IsParallel":false,"HasChild":false},{"Id":12415,"Step":2,"AssigneeNodeId":1,"Instructions":null,"Deadline":{"Days":0,"Hours":0,"Minutes":0,"TotalMinutes":0},"DueDate":"\/Date(1468468800000)\/","Status":0,"IsPinRequired":false,"DistributionType":0,"AssigneeDisplayName":"Default Adminab","Description":"Serial 2","NotifyAssignee":false,"CompletionNotify":false,"IsFyi":false,"SendFyiOnRelease":true,"ChildAssignmentListId":0,"ReleasePaths":"Yes; No; Maybe","ReleaseComment":null,"IsCommentRequired":false,"SelectedReleasePath":null,"DateReleased":null,"NotifyAssigneeTemplate":0,"NotifyAssigneeTemplateDescription":null,"CompletionNotifyTemplate":0,"CompletionNotifyTemplateDescription":null,"IsOverDue":false,"IsParallel":false,"HasChild":false},{"Id":12418,"Step":3,"AssigneeNodeId":1,"Instructions":null,"Deadline":{"Days":0,"Hours":0,"Minutes":0,"TotalMinutes":0},"DueDate":"\/Date(-62135578800000)\/","Status":0,"IsPinRequired":false,"DistributionType":0,"AssigneeDisplayName":"Default Adminab","Description":"Parallel 1","NotifyAssignee":false,"CompletionNotify":false,"IsFyi":false,"SendFyiOnRelease":true,"ChildAssignmentListId":0,"ReleasePaths":"Yes; No; Maybe","ReleaseComment":null,"IsCommentRequired":false,"SelectedReleasePath":null,"DateReleased":null,"NotifyAssigneeTemplate":0,"NotifyAssigneeTemplateDescription":null,"CompletionNotifyTemplate":0,"CompletionNotifyTemplateDescription":null,"IsOverDue":false,"IsParallel":true,"HasChild":false},{"Id":12419,"Step":3,"AssigneeNodeId":1,"Instructions":null,"Deadline":{"Days":0,"Hours":0,"Minutes":0,"TotalMinutes":0},"DueDate":"\/Date(-62135578800000)\/","Status":0,"IsPinRequired":false,"DistributionType":0,"AssigneeDisplayName":"Default Adminab","Description":"Parallel 2","NotifyAssignee":false,"CompletionNotify":false,"IsFyi":false,"SendFyiOnRelease":true,"ChildAssignmentListId":0,"ReleasePaths":"Yes; No; Maybe","ReleaseComment":null,"IsCommentRequired":false,"SelectedReleasePath":null,"DateReleased":null,"NotifyAssigneeTemplate":0,"NotifyAssigneeTemplateDescription":null,"CompletionNotifyTemplate":0,"CompletionNotifyTemplateDescription":null,"IsOverDue":false,"IsParallel":true,"HasChild":false}]

  2. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    117 posts

    Posted 07 Jul Link to this post

    Hello Sohel,

    The Kendo UI TreeList uses the parentIds to determine the root nodes.Since there are no parent nodes, the Kendo UI TreeList will not show any records.

    To display the records in your scenario, use one of the two options below:

    1) Configure the Kendo UI TreeList Data Source with an id and a parentId and make sure that there is at least one parent item returned from the service. In the example code snippet, a parent node will be every node with AssigneeNodeId : null 

    schema: {
      model: {
      id: "Id",
      fields: {
        Id: { type: "number", editable: false, nullable: false },
        parentId: { from: "AssigneeNodeId", type:"number", nullable: true }
      }
     }
    }

    OR:

    2) Configure the Kendo UI TreeList Data Source with a defaultValue:1 (and same as in point 1 - ensure that the remote service returns at least one record with AssigneeNodeId : 1

    schema: {
      model: {
      id: "Id",
      fields: {
      Id: { type: "number", editable: false, nullable: false },
      parentId: { from: "AssigneeNodeId", type:"number", defaultValue: 1 },
      }
     }
    }

    For your convenience, please find a Dojo demo at:

    http://dojo.telerik.com/okAji

    Please let me know if you need any further help with the Kendo UI TreeList.

    Regards,
    Alex
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top