Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:38:24+00:00 2026-06-17T09:38:24+00:00

I have a kendoui treeview displaying some data obtained from a json datasource. The

  • 0

I have a kendoui treeview displaying some data obtained from a json datasource. The treeview is working with the exception that it displays the twisty for child items even when there are no child items.

I believe this is related to my json string but at this point I don’t believe I can change it.

Here is the json string:

[{"Title":"Shared Documents","spriteCssClass":"folder","LastModified":"1/15/2013 10:42:20 AM","Items":[{"Title":"Folder 1","spriteCssClass":"folder","LastModified":"1/15/2013 10:42:20 AM","Items":[{"Title":"Subfolder 1","spriteCssClass":"folder","LastModified":"1/15/2013 10:41:52 AM","Items":[]},{"Title":"Test Tax Document.docx","spriteCssClass":"docx","LastModified":"1/15/2013 10:42:20 AM","Items":[]}]}]}]

I believe the problem is that the Items[] still exist even if there are no items.

Here is the code for my treeview…

var treeDS = new kendo.data.HierarchicalDataSource({
            data: json,
            schema: {
                model: {
                    children: "Items"
                }
            }
        });

var treeview = $("#CCA_DocLibTreeViewer_Tree").kendoTreeView({
            template: "#= item.Title # - #= item.LastModified # <a href='\\#'>View</a>",
            dataSource: treeDS,
            dataTextField: ["Title", "Title"]
        }).data("kendoTreeView");

Any thoughts on what I can do about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:38:24+00:00Added an answer on June 17, 2026 at 9:38 am

    You are right, the question is that if it has Items no matter the length it assumes that has children.

    The solution is either do not generate those empty Items or define treeDS as:

    var treeDS = new kendo.data.HierarchicalDataSource({
        data  : json,
        schema: {
            model: {
                children   : "Items",
                hasChildren: function (node) {
                    return (node.Items && node.Items.length > 0);
                }
            }
        }
    });
    

    You can see that I have defined a hasChildren function that verifies that node.Items exists and its length is actually greater than 0.

    You might see it running in JSFiddle here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using KendoUI Grid to show data. I have server paging working like a
I have KendoUI grid implementation as shown below, it pulls and displays the data
A have a KendoUI window that gets its content from a partial view. That
I have a working autocomplete text box fetching data from mysql server through a
I have a form with some input fields. I am using the tabStrip KendoUI
I have created a kendo.data.dataSource with success, and I am able to bind it
Does Kendo UI PanelBar support HierarchicalDataSource? I have code that works for Kendo TreeView
I have a KendoUI dropdownlist as follows: @(Html.Kendo().DropDownList() .Name(DeviceInterfaces) .OptionLabel(Select interface...) .DataTextField(Name) .DataValueField(Id) .DataSource(source
I have the following code modified from the kendoui demo http://jsbin.com/alupin/6/ I am trying
I am using MVC4 and C#. I have a KendoUI Treeview and I'd like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.