My sources and the target values ββof the pickList of my lines do not change, I followed the example in showface and also looked at some messages here, but still am not able to solve the problem. I use the list from the database to populate the source as follows:
private DualListModel<Course> courseModel; public CourseBean() { List<Course> target = new ArrayList<Course>(); List<Course> source = new ArrayList<Course>(); courseModel = new DualListModel<Course>(source, target); } ...
My converter
import org.omnifaces.converter.SelectItemsConverter; @FacesConverter("courseConverter") public class CourseConverter extends SelectItemsConverter { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { Integer id = (value instanceof Course) ? ((Course) value).getId() : null; return (id != null) ? String.valueOf(id) : null; } @Override public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) { Course course = new Course(); course.setId(Integer.parseInt(value)); return course; } }
and finally my xhtml page:
<h:form> <p:pickList id="coursesOffered" value="#{courseView.courseModel}" var="course" itemValue="#{course}" itemLabel="#{course.courseTitle}" converter="courseConverter" showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains"> <f:facet name="targetCaption">Selected</f:facet> <f:facet name="sourceCaption">All Courses</f:facet> <p:ajax event="transfer" listener="#{courseView.onTransfer}" /> <p:column style="width:10%"> #{course.courseCode}: </p:column> <p:column style="width:90%"> #{course.courseTitle} </p:column> </p:pickList> <p:commandButton id="pojoSubmit" value="Submit" update="displayPlayers" oncomplete="playerDialog.show()" style="margin-top:5px" /> <p:dialog showEffect="fade" hideEffect="fade" widgetVar="playerDialog"> <h:panelGrid id="displayPlayers" columns="2"> <h:outputText value="Source: " style="font-weight:bold" /> <ui:repeat value="#{courseView.courseModel.source}" var="course"> <h:outputText value="#{course.courseTitle}" style="margin-right:5px" /> </ui:repeat> <h:outputText value="Target: " style="font-weight:bold" /> <ui:repeat value="#{courseView.courseModel.target}" var="course"> <h:outputText value="#{course.courseTitle}" style="margin-right:5px" /> </ui:repeat> </h:panelGrid> </p:dialog> </h:form>
PickList is displayed correctly with a source filled with values ββfrom the database, however, when you click a button, only the initial values ββof the source list and the empty target list are displayed in the dialog box even after transferring the interface elements. What am I missing?
source share