我有 2 个单选按钮,一个启用和禁用。如果我单击启用,则应禁用所有 selectmanymenu 标签,反之亦然。请你帮助我好吗。我附上了下面的代码。
单选按钮代码:
<div>
<h:selectOneRadio value="#{userData.data}" layout="pageDirection" id="filterGroup"
required="true" styleClass="control-group searchFilterRow searchFilterFont floatL" >
<f:selectItem itemValue="1" itemLabel="By Part" />
<f:selectItem itemValue="0" itemLabel="By Filter" />
</h:selectOneRadio>
</div>
<div class="floatL filterSection">
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5"
columnClasses="label, value">
<p:outputLabel styleClass="disblock" for="display11" value="Vehicle Programs:" />
<div class="controls">
<p:selectManyMenu id="display11"
value="#{selectManyView.selectedThemes}" converter="themeConverter"
var="t" filter="true" filterMatchMode="contains"
showCheckbox="true" styleClass="selectManyContainer" disabled="#{(userData.data==1)}" >
<f:selectItems value="#{selectManyView.themes}" var="theme"
itemLabel="#{theme.displayName}" itemValue="#{theme}" />
<p:column>
<h:outputText styleClass="ui-theme ui-theme-#{t.name}" />
</p:column>
<p:column>
<h:outputText value="#{t.displayName}" />
</p:column>
</p:selectManyMenu>
</div>
</h:panelGrid>
</div>
<div class="floatL filterSection">
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5"
columnClasses="label, value">
<p:outputLabel for="advanced" value="CSS:" />
<div class="controls">
<p:selectManyMenu id="advanced"
value="#{selectManyView.selectedThemes}" converter="themeConverter1"
var="t" filter="true" filterMatchMode="contains"
showCheckbox="true" styleClass="selectManyContainer" disabled="#{(userData.data==1)}" >
<f:selectItems value="#{selectManyView.themes}" var="theme"
itemLabel="#{theme.displayName}" itemValue="#{theme}" />
<p:column>
<h:outputText styleClass="ui-theme ui-theme-#{t.name}" />
</p:column>
<p:column>
<h:outputText value="#{t.displayName}" />
</p:column>
</p:selectManyMenu>
</div>
</h:panelGrid>
<p:separator />
</div>
豆子代码:
package radioButton;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "userData", eager = true)
@SessionScoped
public class UserData implements Serializable {
private static final long serialVersionUID = 1L;
public String data = "1";
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}