Categories | Question details Back To List | ||
TreeGrid: Expand to Node? Given a fully-loaded treegrid structure, is there a function which will open all the nodes from a parent node to a given descendant? For instance, given the following tree structure: Node 1 |- Node 2 | |- Node 3 | \- Node 4 | \- Node 5 \-Node 6 \- Node 7 What we are looking for is a function which could accept an input of "Node 4" (or it's id, really) and expand Node 1 and Node 2, leaving Node 6 collapsed (and, ideally, allowing a parameter to determine whether Node 4 itself should be expanded or not to show Node 5.) We could create a custom function which discovers the parent and recurses up through the tree, but wanted to make sure there wasn't anything like that already written. Thanks, - David Hutchings CaseCentral, Inc. Answer posted by Support on Jun 20, 2008 07:48 If you are using treeGrid in normal mode ( not dynamic loading one ) the grid.openItem(id) works exactly as necessary in your case , it expands all parent branches from top to necessary item to show item 4 in expanded state grid.openItem(4) to show item 4 in collapsed state grid.openItem(4); grid.closeItem(4); Answer posted by David Hutchings on Jun 24, 2008 13:23 That works like a charm. Thanks! |