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

TreeView Expand Client-Side

1 Answer 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brooke
Top achievements
Rank 1
Brooke asked on 22 Jun 2015, 09:19 PM

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();
                }
            })

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 25 Jun 2015, 03:39 PM
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
Tags
TreeView
Asked by
Brooke
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or