检查另一个复选框时启用复选框

时间:2013-09-06 11:19:16

标签: jsf checkbox primefaces

我在表格中有两列,每列都有一个复选框。

           <p:column headerText="#{msg['labels.ok']}" styleClass="center" style="width:40px;" id="acpCol">
                <p:selectBooleanCheckbox 
                    id="acpSel"
                    value="#{item.acept}"       
                    onchange="checkAcp(this);               
                    disabled="#{item.cancel}">
                </p:selectBooleanCheckbox>
            </p:column>

            <p:column headerText="#{msg['labels.cnx']}" styleClass="center" style="width:40px;" id="cnxCol" >
                <p:selectBooleanCheckbox
                    id="cnxSel" 
                    value="#{item.cancel}""
                    disabled="#{!item.acept}"
                    >
                </p:selectBooleanCheckbox>
            </p:column>

我需要在第一个选中时启用第二个,但是使用javascript,我无法做到。

1 个答案:

答案 0 :(得分:2)

我认为您需要更新第二个,如下所示:

<p:column headerText="#{msg['labels.ok']}" styleClass="center" style="width:40px;" id="acpCol">
    <p:selectBooleanCheckbox id="acpSel" value="#{item.acept}" disabled="#{item.cancel}">
        <p:ajax update="cnxCol"/>  
    </p:selectBooleanCheckbox>
</p:column>
相关问题