kvs
kvs

Reputation: 466

How to enable the root element in tree view

I am working on kendo tree view. Its working well in Google Chrome. When testing that the root node is not in a selected state in IE and firefox. Can any one tell what were the reasons that may occur.

  <div id="treeview"></div>


var data = [
        {
            id   : 1, text: "My Documents", expanded: true, spriteCssClass: "rootfolder",
            items: [
                                { id: 2, text: "w" },
                                { id: 3, text: "wq" },
                                { id: 4, text: "q" },
                                { id: 5, text: "qq" },
                                { id: 6, text: "qeq" },
                                { id: 7, text: "gd" }
                            ]

               }
    ];

var treeview = $("#treeview").kendoTreeView({
    checkboxes: {
        checkChildren: true
    },
    dataSource: data
}).data("kendoTreeView");

Upvotes: 1

Views: 810

Answers (1)

Marko Gresak
Marko Gresak

Reputation: 8207

Solving the problem for last comment:

please suggest me instead of using $("#treeview").find(":checkbox").attr("checked", true); any other function that enable all the checked item default in all browsers

Add change event and change whatever you want in each function.

$("#treeview .k-item input[type=checkbox]:checked").closest(".k-item").each(function(){
    // change whatever you want, for example:
    $(this).css("color","green");
});

This is similar to what you're using, but I've checked it in Chrome, Firefox and IE and works fine. See this Fiddle (adapted from KendoUI demos).

Upvotes: 1

Related Questions