我正在使用 Primefaces 4.0 和 JSF 2.2。我使用带有转换器的选项列表。arg2
问题是我的转换器没有得到正确的结果。它总是说0
。我的期望是这是元素的 id,我可以将它从源/目标列表中解析出来。有任何想法吗?
我Converter
的灵感来自How to write a custom converter for <p:pickList>。
我的 Picklist 声明如下:
<p:pickList value="#{loadingPlaceGroups.pickList}"
style="margin:0" var="loadingPlace"
converter="primeFacesPickListConverter"
itemValue="#{loadingPlace}"
itemLabel="#{loadingPlace.name}#{loadingPlace.location.address.street}#{loadingPlace.location.address.houseNr}#{loadingPlace.location.address.zipCode}#{loadingPlace.location.address.city}"
showSourceFilter="true" showTargetFilter="true"
filterMatchMode="contains"
styleClass="picklist500x350source picklist500x350target">
<f:facet name="sourceCaption">Alle Ladestellen</f:facet>
<f:facet name="targetCaption">Gewählte Ladestellen</f:facet>
<p:column style="border-bottom:1px solid lightgray">
<p:panelGrid>
<p:row>
<p:column style="padding-left:0;font-size:12pt">
<h:outputLabel value="#{loadingPlace.name}"
style="font-weight:bold" />
</p:column>
</p:row>
<p:row>
<p:column style="padding:0">
<h:outputLabel
value="#{loadingPlace.location.address.street} #{loadingPlace.location.address.houseNr}" />
</p:column>
</p:row>
<p:row>
<p:column style="padding:0">
<h:outputLabel
value="#{loadingPlace.location.address.zipCode} #{loadingPlace.location.address.city}" />
</p:column>
</p:row>
</p:panelGrid>
</p:column>
</p:pickList>