Jump to content

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

  • John
    • Jacob
      • Jingleheimer
        • Schmidt
  • Jane
    • Doe

Searching "Jane" should return

  • John (collapsed)
  • Jane
    • Doe

Any ideas?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.