0
嗨我正在使用p:layout組件。當(datagrid)arraylist爲空時渲染面板
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>
現在我想渲染面板如圖所示,當列表爲空之上,如果 空,那麼面板將不會呈現。因此,我們知道我們有 p:輪詢組件,該組件在指定的時間間隔後自動更新任何特定面板或任何其他組件。所以我已經用這種方式申請輪詢 聽衆和檢查名單大小。
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;
}
}
我應該如何渲染我的面板?