Tree Navigation OnSelected

Hi Axure Friends,

I have a tree navigation in my prototype. I want to select a tree item and have it remain selected while on a given page. I have this almost working, but the item will not “stay” selected. Instead, it remains highlighted in the color I have chosen while the page briefly loads. I am observing this through the axure preview where it is displaying an HTML page(s). I am currently using the Axure Enterprise RP 8.0.1 trial while my company purchases the licensed version.

Any ideas?

Thank you.

Are you using the tree element provided by axure?
Also, can you describe your problem a bit more… when is the item getting dis-selected?

Hi There,

Yes, I am using the out of the box Tree Control found by searching in the Axure library of widgets.

Steps to reproduce the behavior:

  1. F5 to run the preview.
  2. In the browser window, I click on the item in the tree. When I end my click on the mouse (mouse button up) the item is briefly highlighted in the blue background color that I want it to remain selected with. Instead, what happens is that the Blue background appears only briefly, while the page loads.

Am I use the wrong “Interaction”? I am setting this in the masterpage. Wrong place…?

Hi Doug123,

If I’ve understood what you’re going for, you should be able to do this by creating a “Selected” interaction style for the tree node you’d like to be selected and then having that node’s “OnClick” event set itself to its selected state:

This way the node’s specified selected style will be applied (and stay applied) whenever it’s clicked. If you’re not yet familiar with interaction styles, this tutorial might help:

Axure | Interactive Button Tutorial

Let me know if you have any questions about this!

If I delete the Onclick Open (other page) event that I have on the same tree node, the selection appears correctly. When the two appear together the selection does not appear. (I suspect it is wiped out by the fact a new page is loading, just a guess.) I thin this may have more to do with maintaining state across pages. I’m having the same problem with an image that I “turn off” reappearing when the next page loads.

I managed to get this figured out using a global variable and a condition to maintain the state for a given tree node. This is going to get a bit sloppy for 20+ tree nodes, but it will work.

Is there a better approach?

(I should mention that beside each tree node I now have an icon that indicates if the form for that corresponding node has been completed (checkmark image appears) or not (checkmark disappears).

Hi Doug,

It doesn’t sound like there’d be a way around using global variables and setting a node’s selected state based on the variable value. I agree that this approach can be difficult to maintain, but it may be the most straightforward.


For what it’s worth, what can apply for this use case is to use a repeater widget to create a custom tree (which is a big leap into advanced prototyping). Since the OnItemLoad event is evaluated for each repeated item, you could create an OnItemLoad conditional case that evaluates whether a set variable equals a matching row value and then dynamically set the selected state where the values match.

Here’s a sample: Tree.rp (57.4 KB)

What can get tricky with a repeater tree is determining how to expand and collapse certain nodes, since that isn’t built in in the repeater. Here’s a sample provided by a forum user in case it’s something you wanted to look into:

https://forum.axure.com/t/dynamic-tree-with-check?u=alex_axurebox/29509/23

1 Like

Thank you - I’ve accomplished it through global variables as per your note.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.