TreeView checkboxes; checkChildren

2 posts, 0 answers
  1. Mathias
    Mathias avatar
    15 posts
    Member since:
    Oct 2014

    Posted 20 Jan 2015 Link to this post

    Hey i've a Problem with KendoTreeview. I build a TreeView with a json Datasource
    [
    {"id":1,"text":"foo","expanded":true,"items":
    [
    {"id":2,"text":"foo2","expanded":false,"checked":false},
    {"id":3,"text":"foo2-1","expanded":false,"items":
    [
    {"id":4,"text":"foo3","expanded":false,"checked":false}
    ]
    ,"checked":false}
    ],"checked":true
    }
    ]
    JS Code:
    $(document).ready(function() {
    var dataSource = new kendo.data.HierarchicalDataSource({
    transport: {
    read: {
    url: servlet,
    datatype: "json",
    contentType: "application/json"
    }

    },
    schema: {
    model: {
    children: "items",
    id: "id"
    },
    data: function(data) {
    var dataArray = eval(data);
    return dataArray;
    }
    }
    });

    var treeView = $("#treeView").kendoTreeView({

    dataSource: dataSource,
    dataTextField: "text",
    checkboxes: {
    checkChildren: true
    }
    });
    It works well but if i use checkChildren: true the pre check is not working. if i use only checkboxes: true without checkchildren pre check works but not check all childs. What is wrong ?

  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 22 Jan 2015 Link to this post

    Hello Mathias,

    The nodes, serialized in such way, conflict with the checkChildren functionality -- if the root node is checked, all its child nodes need to be checked, too. You can either serialize all nodes as checked, or not serialize the checked state for the child nodes (as seen in this Dojo snippet).

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top