-
1. Re: Saving state on simpleTogglePanel or panelMenu
crisyag Feb 1, 2008 10:10 AM (in response to michael.litherland)I also have this problem with simple toggle panel, does someone know how to keep state (collapsed ou opened) of a simple toggle panel?
Thanks
Cristiane Yaguinuma. -
2. Re: Saving state on simpleTogglePanel or panelMenu
nbelaevski Feb 1, 2008 3:05 PM (in response to michael.litherland)Mike, Cristiane,
You can use <a4j:support> binded to onexpand, oncollapse etc. events or make panels AJAXed by means of "switchType" (for simpleTogglePanel) and "expandMode" (for panelMenuGroup) -
3. Re: Saving state on simpleTogglePanel or panelMenu
crisyag Feb 13, 2008 4:49 PM (in response to michael.litherland)Hello Nick, thanks a lot for your answer
I tried to use <a4j:support> binded to onexpand and oncollapse but it didn't work. I'm using switchType = 'ajax' for simpleTogglePanel, but I didn't understand how can I use it to save state, can you explain more about it?
Thanks again,
Cristiane Yaguinuma. -
4. Re: Saving state on simpleTogglePanel or panelMenu
ilya_shaikovsky Feb 19, 2008 6:23 AM (in response to michael.litherland)for client mode - saving state performed in the next way:
<h:form> <rich:simpleTogglePanel label="STP" switchType="client" opened="#{bean.enabled}"> <a4j:support event="onexpand" action="#{bean.disable}"/> <a4j:support event="oncollapse" action="#{bean.disable}"/> <h:outputText value="content"/> </rich:simpleTogglePanel> </h:form>
public String disable() { setEnabled(!isEnabled()); return null; }
For ajax mode:<h:form> <rich:simpleTogglePanel label="STP" switchType="ajax" opened="#{bean.enabled}" action="#{bean.disable}" reRender="repeater"> <h:outputText value="content"/> </rich:simpleTogglePanel> </h:form>
method code - the same. -
5. Re: Saving state on simpleTogglePanel or panelMenu
ilya_shaikovsky Feb 19, 2008 6:26 AM (in response to michael.litherland)B.t.w. seems you helps to allocate real bug:
http://jira.jboss.com/jira/browse/RF-2299.
But It will not influence to your task of saving state.
Thanks. -
6. Re: Saving state on simpleTogglePanel or panelMenu
oneilltg Apr 11, 2008 12:39 PM (in response to michael.litherland)Your example for the client switch type is so simple that I'm embarassed that I can't get it to work. The ajax example works fine for me. With the client one, the disable method doesn't get called. For the ajax one, it does get called. Does anyone see what I'm doing wrong with the client type? Here is my xhtml with two simple toggle panels, one client and one ajax.
I'm using richfaces 3.1.4
Thanks,
Tom
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:app="http://www.aluapaddockpro.com/jsf"
template="horseInformationTemplate.xhtml">
<ui:define name="horseContent">
<h:form>
<rich:simpleTogglePanel label="client switch"
switchType="client"
opened="#{horseFarrierInformationScreenBB.enabled}">
<a4j:support event="onexpand"
action="#{horseFarrierInformationScreenBB.disable}"/>
<a4j:support event="oncollapse"
action="#{horseFarrierInformationScreenBB.disable}"/>
<h:outputText value="content goes here"/>
</rich:simpleTogglePanel>
</h:form>
<h:form>
<rich:simpleTogglePanel label="ajax switch"
switchType="ajax"
opened="#{horseFarrierInformationScreenBB.enabled}"
action="#{horseFarrierInformationScreenBB.disable}">
<h:outputText value="more content"/>
</rich:simpleTogglePanel>
</h:form>
</ui:define>
</ui:composition>
backing bean method:
public String disable()
{
log.warn("in disable method!");
setEnabled(!isEnabled());
return null;
}