TreeView Expand Client-Side

2 posts, 0 answers
  1. Brooke
    Brooke avatar
    2 posts
    Member since:
    Jul 2014

    Posted 22 Jun 2015 Link to this post

    I have a treeview with an expand mode of ServerSideCallBack. I would like to be able to select a node by value and expanding the path via client-side. I'm was trying to get all of the parent nodes and call the expand() method down to the node, but after the first expand it told me "could not call expand of null." Could you help me with this problem?

    var count = 0;
                $.each(value.list, function (otherkey, othervalue) {
                    count = count + 1;
                    var tree = $find("pagesLeftNav_treeView");
                    var node = tree.findNodeByValue(othervalue.pageid);
                    if (count != value.list.length) {
                        node.expand();
                    }
                })

  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 25 Jun 2015 Link to this post

    Hello Brooke,

    I am afraid that the reason for the experienced issue is the fact that the nodes in ServerSideCallBack expand mode are not yet loaded, until the parent one is expanded. This mode is purposed for loading time optimization which is why the child are not loaded, until the parent is expanded. This is the reason why no reference is acquired using the findNodeByValue and hence the  "could not call expand of null." error is encountered.

    If you need to achieve the desired functionality, you would need to avoid using the aforementioned expand mode. You can test the behavior, using ServerSide expand mode for example.

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top