I have an issue with Primefaces Select One Menu, I used it with a Java List. Here's my code:
<h:form id="frmRatePlanDetail">
<h:panelGrid columns="2">
<p:outputLabel value="Rate plan detail name" for="txtRatePlanDetailName"/>
<p:inputText id="txtRatePlanDetailName"
required="true"
maxlength="400"
value="#{ratePlanDetailController.ratePlanDetail.ratePlanDetailName}"
style="width: 300px;"/>
<c:forEach begin="0" end="#{ratePlanDetailController.listMappingDetail.size()-1}"
var="idx" step="1" >
<p:outputLabel value='#{ratePlanDetailController.listMappingDetail.get(idx).propertyId.propertyName}' for="cboProperty"/>
<p:selectOneMenu
id="cboProperty"
required="true"
style="min-width: 306px;"
value="#{ratePlanDetailController.listMappingDetail.get(idx).zoneId.zoneId}">
<f:selectItems value="#{ratePlanDetailController.listZoneByZoneMapId(ratePlanDetailController.listMappingDetail.get(idx).zoneId.zoneId)}"
var="z"
itemLabel="#{z.zoneName}"
itemValue="#{z.zoneId}"/>
<p:ajax event="change" update="@this" />
</p:selectOneMenu>
</c:forEach>
</h:panelGrid>
<p:spacer height="20"/>
<div align="right" style="margin-top: 5px;">
<p:column colspan="2" >
<p:commandButton
value="OK"
process="frmRatePlanDetail"
action="#{ratePlanDetailController.insert()}"
update="@([id$=treeProfileEvent]) @([id$=frmRatePlanDetail])" />
<p:commandButton value="#{lang['common.button.cancel']}"
immediate="true"
onclick="PF('wdlgRatePlanDetail').hide()"
update="@([id$=treeProfileEvent])" />
</p:column>
</div>
</h:form>
ratePlanDetailController.listMappingDetail.get(idx).zoneId.zoneId is an Interger.
It look like select one menu doesn't update value when I clicked commandButton 'OK'.
I always get null value in ratePlanDetailController.listMappingDetail.get(idx).zoneId.zoneId.
Is there anyway to update the value for an object in List ?Any help would be great
Aucun commentaire:
Enregistrer un commentaire