0
我有兩個oneSelectMenu加載基於登錄詳細信息,然後第二個基於第一selectOneMenu用於的onchangeEvent selectOneMenu用於應加載值默認值menu.i試圖清除onchange事件前的默認值,但遺體值並且不能與onchange事件一起使用。H:selectOneMenu用於onchange事件不工作
<h:selectOneMenu id="blS" value="#{BoardAction.serviceAreaId}" >
<f:ajax event="valueChange" render="blSearchFacilityInput" listener="#{BoardAction.svaValueChangeEvent}"/>
<f:selectItems value="#{BoardAction.serviceAreaList}" var="c" itemLabel="#{c.svaCode}" itemValue="#{c.id}"/> </h:selectOneMenu>
<h:selectOneMenu id="blSearchFacilityInput" value="#{BoardAction.facilityId}"> <f:ajax event="valueChange" render="blSearchSectorInput" listener="#{BoardAction.facValueChangeEvent}"/>
<f:selectItems value="#{BoardAction.svaFaciltyList}" var="c" itemLabel="#{c.facCode}" itemValue="#{c.id}"/></h:selectOneMenu>
的ActionBean:
private List<FacilityEBean> svaFaciltyList=null;
public List<FacilityEBean> getSvaFaciltyList() {
svaFaciltyList = facilityBusServ.getFacilityListBySVAId(session.getLoginUser());
return svaFaciltyList;
}
public List<FacilityEBean> svaValueChangeEvent(){
if(svaFaciltyList!=null){
svaFaciltyList.clear();
svaFaciltyList=null;
}
svaFaciltyList = facilityBusServ.getFacilityList(Integer.parseInt(serviceAreaId));
return svaFaciltyList;
}
非常感謝@ BalusC,它清除了我的誤解。 –