This is a migrated thread and some comments may be shown as answers.

TreeView - Expanding problems (2013.3.1309 and 2013.3.1119)

1 Answer 57 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Luciano
Top achievements
Rank 1
Luciano asked on 14 Jan 2014, 06:54 PM
Hi,

I'm having a problem and I just can't figure out what I'm doing wrong.

Basically .expand(".k-item") is not expanding any item.  I'm using the latest internal version (2013.3.1309).

I'm not using the latest published version (2013.3.1119) since with this one I couldnt expand any item at all.
(i even created a jsbin with this problem of not expanding any item, although i'm not sure if it has anything to do with this later problem)

The code for the expand method problem is right below.

Thanks in advance,
Luciano / Fabricio

var treeDataSource = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: settings.GetTreeDataAction,
            dataType: 'json',
            type: 'POST'
        }
    },
    schema: {
        data: "Model.RootItems",
        model: {
            children: "ChildItems",
            hasChildren: "ChildItems.length > 0"
        }
    }
});
 
var treeView = $("#treeview").kendoTreeView({
    dataSource: treeDataSource,
    dataTextField: "Item.Nome",
    loadOnDemand: false
}).data("kendoTreeView");
 
treeView.expand(".k-item");

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 15 Jan 2014, 08:19 AM
Hello Luciano,

This is a problem that occurs when the TreeView is initialized from an empty <ul> element and contains a dataSource. The dataSource itself attempts to infer the data from the ul and replaces the schema. We are aware of this problem, but have not yet found a graceful way of handling this internally. If you use a <div> element, the problem disappears.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Luciano
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or