2 Replies Latest reply on May 27, 2009 1:35 AM by jschneiderhan

    rich:orderingList selection not injecting

    imcmahon

      I have a rich:orderingList which displays a list of routes, and one of the things it does is populate a selected= collection in the backing bean.  I setup selectedRoutes as an @In Collection, but it's null when I enter either of the action methods.  @In String newPoint is being injected properly, and the add point method works fine.




                      <rich:orderingList id="pointList" value="#{route.routePoints}" selected="#{selectedRoutes}" var="point" listHeight="300" listWidth="350">
                          <rich:column  width="180">
                              <f:facet name="header">
                                  <h:outputText value="Waypoint" />
                              </f:facet>
                              <h:outputText value="#{point.waypoint.identifier}"/>
                          </rich:column>
                      </rich:orderingList>
                      <h:form>
                          <h:inputText id="newPoint" value="#{newPoint}" required="false"/>
                          <a:commandButton action="#{routeManager.addPoint()}" value="Add New" reRender="pointList"/>
                          <a:commandButton action="#{routeManager.delSelected()}" value="Del Selected" reRender="pointList"/>
                      </h:form>



          @Out
          private Route route;
      
          @In(required=false)
          private String newPoint;
      
          @In(required=false)
          private Collection<RoutePoint> selectedPoints;
      
          @Factory("route")
          public void getRoute() {
              route = (Route)em.createQuery("Select r from Route r where r.id = 1").getSingleResult();
          }
      
          public void addPoint() {
              if(newPoint == null || newPoint.equals("")) return;
      
              route.addWaypoint(new Waypoint(newPoint));
              route.reOrder();
              em.merge(route);
          }
      
          public void delSelected() {
              if(selectedPoints==null) return;
      
              for(RoutePoint p:selectedPoints) {
                  route.getRoutePoints().remove(p);
              }
              route.reOrder();
              em.persist(route);
          }