MisterDesai Posted August 14, 2014 Report Posted August 14, 2014 I'm trying to create a better user interface for my tree navigation. The tree will ultimately have hundreds of items within it and I'm adding a search bar (simple string control). I'm looking for someway to problematically hide all of branches that don't contain the search query but I can't find any methods or properties that can do this. Any ideas? Quote
mje Posted August 15, 2014 Report Posted August 15, 2014 The only way I know of is to modify or rebuild the tree in response to the changing search string. I don't think you can hide individual nodes. Quote
mgunning Posted August 17, 2014 Report Posted August 17, 2014 As MJE said, I don't think you can hide branches without rebuilding the tree. But you can close all the branches that don't contain the search query, and only open the branch that does, if that would be sufficient.Use the "Open/Close" >> "All" method to close all branches, followed by the "Open/Close" >> "Ensure Visible" method to open only the branchthat contains a particular tag. 1 Quote
MisterDesai Posted August 20, 2014 Author Report Posted August 20, 2014 mgunning, you are spot on! The only problem that I am facing now is that I want to open the child branches of the matched search term as well. For example, the complete tree is JohnJacobJingleheimerSchmidt JaneDoe Searching "Jane" should return John (collapsed) JaneDoe Any ideas? Quote
mgunning Posted August 20, 2014 Report Posted August 20, 2014 Well, to find the child branches of "Jane", you can use the "Navigate Tree" method. "Navigate Tree" >> "Get Child" will find the first child. "Navigate Tree" >> "Get next item" will find the next child at the same level of the hierarchy. It will return an empty string if there are no more items at that level, so just keep searching until you come up with an empty string and you will have found all the branches under "Jane". You can then use the "Open/Close" >> "Ensure Visible" method to open all these branches. If you want to open the entire hierarchy underneath "Jane" right down to the very last twig, you will have to search through each branch to find the final value of each branch, and use "Open/Close" >> "Ensure Visible" to open all those values. Quote
Tim_S Posted August 21, 2014 Report Posted August 21, 2014 For searching, you may wish to create a separate dataset from the tree control that better allows searching. This dataset would need to include the tag name of the entry in the tree. Navigating through a tree is not the fastest thing in the world. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.