Reputation: 5399
I would like to set the style of my dependent on the value of its "opened" attribute. To be more specific: if the value of opened==false I would like to hide the simpleTogglePanel on printouts (i.e. setting style to display:none).
so something like this (pseudo code):
<rich:simpleTogglePanel opened="false" styleClass="#{ if opened then regular else hidePrint}" />
Is this possible? How? I'm using Richfaces 3.3.2.!
Upvotes: 0
Views: 992
Reputation: 27496
Use rendered attribute of your component.
<rich:simpleTogglePanel rendered=#{bean.boolean} />
EDIT
You should have a boolean property in your managed bean, so you will know if it's your togglePanel opened or not. So something like
@ManagedBean
@RequestScoped
public class Bean {
private boolean opened;
//setters and getters
}
then on your page change your togglePanel like this
<rich:simpleTogglePanel opened="#{bean.opened}" rendered="#{bean.opened}">
set the property in your bean to true or false depending on if you want to hide your togglePanel defaultly. Or you can hide it everytime when it's get toggled with Ajax, put this line inside the simpleTogglePanel tag
<p:ajax listener="#{bean.hidePanel}" update=":panel" />
set id of your panel to panel and add method hidePanel to your panel which just sets the boolean opened to false. Edit - it also should work without that listener
Upvotes: 1