Jump to content

Search a Tree Control


Recommended Posts

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?

Link to comment

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 branch
that contains a particular tag.
 

  • Like 1
Link to comment

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.

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.