【发布时间】:2014-01-10 17:44:21
【问题描述】:
我有一个仪表板,其中包含大量运行良好的小部件/面板。
我正在寻找一种方法来使用 commandButton 动作侦听器切换特定的可见性,而无需刷新页面,即通过 AJAX。
<p:dashboard id="board" model="#{dashboardBean.model}">
<!-- iteration code begins -->
<p:panel id="#{wdgt.code}" header="#{wdgt.title}">
<h:outputText value="One of the dozens of widgets" />
</p:panel>
<!-- iteration code ends -->
<p:panel id="staticWdgtId" header="Static Widget Initially Invisible" visible="false">
Some static content
</p:panel>
</p:dashboard>
然后在后台 bean 中,有时需要通过 commandButton 或 actionListener 触发此操作...
public void showTheWidget() {
DashboardColumn dbc = this.model.getColumn(1);
dbc.getWidget(2); // does not get a widget object with a visibility attribute :((
// so that I could manipulate such as dbc.getWidget(2).setVisible(true);
}
有什么想法吗?
【问题讨论】:
标签: ajax jsf primefaces dashboard