禁用/启用primefaces组件

时间:2015-05-10 21:50:50

标签: jsf-2 primefaces

我希望在从p:selectOneMenu中选择后禁用某些素数组件,但是当我选择没有选择选项时,它仍会被禁用

<p:outputLabel value="Manager" style="color:white;font-weight: bold;" />
<p:selectOneMenu id="manager" value="#{employeeMB.selectedManager}" immediate="true">
     <f:selectItem itemLabel="Selectionner..." noSelectionOption="true"/>
     <f:selectItems value="#{employeeMB.managers}"  />
     <p:ajax update="managerSelect role"  />
</p:selectOneMenu>

<p:outputLabel value="Est un Manager" 
               style="color:white;font-weight: bold;" />
<p:selectBooleanCheckbox id="managerSelect" 
                         value="#{employeeMB.employee.isManager}" 
                         disabled="#{employeeMB.selectedManager != null}" />

<p:outputLabel for="role" value="Role Utilisateur" style="color:white;font-weight: bold;" />
<p:selectManyCheckbox id="role" value="#{employeeMB.selectedRoles}">
    <f:selectItem itemLabel="Employée" itemValue="ROLE_EMPLOYEE" />
    <f:selectItem itemLabel="Manager" itemValue="ROLE_MANAGER" itemDisabled="#{employeeMB.selectedManager != null}"/>
    <f:selectItem itemLabel="RH" itemValue="ROLE_RH" itemDisabled="#{employeeMB.selectedManager != null}"/>
</p:selectManyCheckbox>

0 个答案:

没有答案