Primefaces在<p:ajax listener =“”>之后更新组件

时间:2015-09-09 15:05:28

标签: ajax jsf jsf-2 primefaces

我有一个selectOneMenu,用于更改辅助bean中的值,并根据该值显示或不显示另一个组件。我想要的是在selectOneMenu更改支持bean中的值后更新该特定组件

Sub DeleteRowsThatLookEmpty()
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Dim Rng As Range, ix As Long
    Set Rng = Intersect(Range("A:A"), ActiveSheet.UsedRange) 'You can specify the sheet you want and change the column
    For ix = Rng.Count To 1 Step -1
        If Trim(Replace(Rng.Item(ix).Text, Chr(160), Chr(32))) = "" Then
            Rng.Item(ix).EntireRow.Delete
        End If
    Next

    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
End Sub

支持bean中的值发生了变化,但未更新。

1 个答案:

答案 0 :(得分:0)

这应该有效

<h:selectOneMenu value="#{backingBean.id.value}" >
        <f:selectItem itemLabel="Choose" itemValue="0"/>
        <f:selectItems value="#{backingBean.idList}"
            var="id" itemLabel="#{id.name}" itemValue="#{id.value}" />
         <p:ajax listener="#{backingBean.changeId}" process="@this" update="userMenuWrapper"/>
</h:selectOneMenu>
<p:outputPanel id="userMenuWrapper">
    <p:menu id="userMenu" rendered="#{backingBean.id.value != 0}"/>
</p:outputPanel>