如何使用primefaces启用我的单选按钮

时间:2014-08-04 14:02:35

标签: ajax primefaces selectoneradio

启用/禁用我的selectOneRadio不能像预期的那样工作。它仅在“提交”之后激活,并且ajax-direct方法不起作用。

enter image description here

当我将选择(单击)更改为“组”时,选择后的dropDown将保持“禁用”状态。它只出现在“提交”之后,但我喜欢有直接的ajax功能。

<div>
<p:outputPanel id="customPanel" style="margin-bottom:10px">
    <p:selectOneRadio id="locationType" value="#{bean.query.locationType}"
        required="true" layout="custom">
        <f:ajax render="locationGroup locationOrganization">
            <f:selectItems value="#{bean.locationTypeSelectItems}"
                           var="locationTypeItem" itemValue="#{locationTypeItem}" itemLabel="#{msgs[locationTypeItem.label]}" />
        </f:ajax>
    </p:selectOneRadio>

    <h:panelGrid columns="3" cellpadding="5">
        <p:radioButton id="option1" for="locationType" itemIndex="0" />
        <p:outputLabel for="locationGroup" value="Group"/>
        <p:autoComplete id="locationGroup"
                        value="#{bean.query.locationGroup}"
                        completeMethod="#{bean.completeGroups}"
                        var="group"
                        itemLabel="#{group.description}"
                        itemValue="#{group}"
                        converter="org.company.project.presentation.group.GroupConverter"

                        maxResults="10"
                        dropdown="true"
                        cache="true"

                        disabled="#{bean.locationGroupDisabled}"/>

        <p:radioButton id="option2" for="locationType" itemIndex="1" />
        <p:outputLabel for="locationOrganization" value="#{msgs.pat_Organization}"/>
        <p:autoComplete id="locationOrganization"
                        value="#{bean.query.locationOrganization}"
                        completeMethod="#{bean.completeOrganizations}"
                        var="organization"
                        itemLabel="#{organization.name}"
                        itemValue="#{organization}"
                        converter="org.company.project.presentation.organization.OrganizationConverter"

                        maxResults="10"
                        dropdown="true"
                        cache="true"

                        disabled="#{bean.locationOrganizationDisabled}"/>

        <p:radioButton id="option3" for="locationType" itemIndex="2" />
        <p:outputLabel value="All" />

    </h:panelGrid>
    <p:message for="locationGroup" />
    <p:message for="locationOrganization" />
</p:outputPanel>
<p:message for="locationType" />

这就是所有人!

0 个答案:

没有答案