This question is locked. New answers and comments are not allowed.
I have a tree view created in a razor template bound to a hierarchical tree view. How do I expand just the root node of the tree?
edit: had to run off, here's some more detail.
I have a treeview populated by binding to a hierarchical data model. I can't find a way to expand just the root node in the BindTo code (only ExpandAll seems to exist, which doesn't work the way I want. It looks like it would work if I disabled all but the root node, but then I'd have to go back through and re-enable all of the nodes, which doesn't seem like it should be the right way to do something this trivial).
I'm trying to get the following javascript sample to work (with the appropriate ID name), but it doesn't seem to be working:
edit: had to run off, here's some more detail.
I have a treeview populated by binding to a hierarchical data model. I can't find a way to expand just the root node in the BindTo code (only ExpandAll seems to exist, which doesn't work the way I want. It looks like it would work if I disabled all but the root node, but then I'd have to go back through and re-enable all of the nodes, which doesn't seem like it should be the right way to do something this trivial).
I'm trying to get the following javascript sample to work (with the appropriate ID name), but it doesn't seem to be working:
var treeview = $('#ProductsTreeView').data('tTreeView'); var firstNodeElement = $("li:first", treeview.element)[0]; treeview.expand(firstNodeElement);