Hiding or showing Dyamic Panels based on their names


#1

Say I have a dozen dynamic panels with the name “definitionPANEL”. Can I use some kind of logic so that when I click on a button it hides dynamic panels based on its name? SO, I could hide and show all panels named “definitionPANEL”?


#2

Yes you can hide and show dynamic panel


#3

You can do it very well with STATE, it’s simple, for example you place several buttons and you name them according to the name of the widgets that you will create which will be them in THE SAME DYNAMIC PANEL.
And then you just have to do:

EX:
ONCLICK ButtonPanel1 - SET PANEL STATE 1 …

And if you want to display all the widgets at the same time as in a sorting system, you only have to define A STATE where you will display all the widgets named at the same time.

(there are also other methods to solve your problem)

I made a small example in an RP file to better understand my explanation.

exForums.rp (2.0 MB)


#4

I think you are trying to set up a conditional statement where you could set a variable and then perform an action (show/hide) on panels that have a name that matches the variable. Axure can’t do that. When you perform a show/hide action you have to select the target for that action. You can have multiple targets for the same action, but you have to select each target. The only way I can think of do to that is to set each panel up in a repeater and have a column for the name. Then you can mark rows with that name and delete them which would hide them, or unmark them to show again. Not sure it that’s worth the complexity or not. I’ve attached a file that shows multiple targets to show/hide when you click a button.
Multi targets to toggle.rp (64.9 KB)


#5

Hi!

You can hide / show widgets by name using Axure’s javascript API. (It’s not as complicated as it sounds. ) To add javascript, you use the Open Link command and put the javascript where the external URL would go.

To hide something by name, you’d add this:

javascript:
$axure('@[[fieldText]]').hide();
void(0);

… where fieldText is a global or local variable containing the name of the widget you want to hide. Note that all widgets with that name on the current page will hide. To show, do the same thing but replace hide() with show()

Important! If you are on a Mac, go to System Preferences > Keyboard > Text and turn off “smart quotes” (it’s a checkbox.). Otherwise, you’ll be entering slanted quotes that javascript doesn’t recognize and the script won’t work.

hidebyname.rp (50.6 KB)