TreeView - Expanding problems (2013.3.1309 and 2013.3.1119)

2 posts, 1 answers
  1. Luciano
    Luciano avatar
    1 posts
    Member since:
    Aug 2011

    Posted 14 Jan 2014 Link to this post

    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");

  2. Answer
    Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 15 Jan 2014 Link to this post

    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!
Back to Top