Hi I am using p:layout component.
p:layout style="min-width:400px;min-height:200px;" id="layout">
<p:layoutUnit position="west" resizable="true" size="100" minSize="40" maxSize="200">
<p:panel id="pnl" header="Help" toggleable="true" toggleSpeed="500"
closeSpeed="500" widgetVar="panel" style="width:265px" rendered="#{backBean.renderPanel}">
</p:panel>
<p:dataGrid var="sample" value="#{backBean.list}"
columns="1" style="margin-left: -5px;width: 275px; border:none;"
rows="7" >
//displaying some values from list here
</p:dataGrid>
<p:poll interval="3"
listener="#{backBean.check}" update="pnl" />
</p:layoutUnit>
<p:layoutUnit position="center">
Center
</p:layoutUnit>
Now I want to render panel as shown above when list is empty,if its empty then panel will not get rendered. So I as we know we have p:poll component which automaticallly updates any particular panel or any else component after specified interval. So I have applied poll listener and checking list size in this way.
public void check(){
if(list.size>0){
renderPanel=false;
}
else{
renderPanel=true;
}
}
which is working fine . I am getting value of renderPanel flag as true when list is empty , but still my panel is not rendering.
why is it so? what I am missing?
My backing bean code for renderPanel flag :
@ManagedBean
@ViewScoped
class BackBean implements Serializable{
private boolean renderPanel=false;
public boolean isRenderPanel() {
return renderPanel;
}
public void setRenderPanel(boolean renderPanel) {
this.renderPanel = renderPanel;
}
}
How should I render my panel ?