I’m using the primefaces layout component and have a center and a right layoutUnit. I would like to have a link/button in the center layout that expands the right layoutUnit as I default the right layout to collapsed state when I first load the page. I’m using a boolean expression on the right layoutUnit and I update it from my link. Everything works except that the right layoutUnit doesn’t get ajaxed updated from my link. If I refresh the page the right layoutUnit is expanded.
page:
<h:form prependId="false">
<p:layout fullPage="true">
<p:layoutUnit id="right" position="right" width="350" header="Marker Details" resizable="true" closable="true" collapsible="true" collapsed="#{mapBean.rightCollapsed}">
<h:outputText value="#{mapBean.text}" />
</p:layoutUnit>
<p:layoutUnit position="center">
<p:commandLink actionListener="#{mapBean.showDetail}" update="right" value="Expand Right Layout"/>
</p:layoutUnit>
</p:layout>
</h:form>
Bean:
public class MapBean implements Serializable {
private boolean rightCollapsed=true;
public void showDetail(ActionEvent e){
rightCollapsed=false;
}
//getter/setter for rightCollapsed
See the following forum post about using the
<p:layout>component with thefullPage=trueattribute.http://primefaces.prime.com.tr/forum/viewtopic.php?f=3&t=4766
You cannot wrap the layout component in a form like this, each
<p:layoutUnit>needs its own nested form. You can stillupdatethe components of the other forms by setting the form id and referring to component ids correctly as another answer had suggested. Try something like this: