3 Replies Latest reply on Jun 16, 2008 2:43 PM by Victor Bucutea

    rich:dataList not being rerendered

    Victor Bucutea Newbie

      Hi ,


       <h:form id="adaugareProdusForm">
       <rich:pickList value="#{pickListBean.result}">
       <f:selectItems value="#{pickListBean.produse}" />
      
       <a4j:support event="onlistchanged" reRender="result,items" />
       </rich:pickList>
       <a4j:commandButton value="reRender" reRender="result"></a4j:commandButton>
      
       <h:outputText id="items" value="#{pickListBean.items} Options Choosen"></h:outputText>
      
       <rich:dataList id="result" value="#{pickListBean.produseSelectate}" var="pickList"
       rendered="#{pickListBean.items>0}" styleClass="pickListConfirmation">
       <h:outputText value="#{pickList.denumire}" /><f:verbatim> | </f:verbatim>
       <h:outputText value="#{pickList.cod}" /><f:verbatim> | </f:verbatim>
       <h:outputText value="#{pickList.descriere}" /><f:verbatim> | </f:verbatim>
       </rich:dataList>
       <a4j:outputPanel ajaxRendered="true">
       <h:messages/>
       <rich:messages></rich:messages>
       </a4j:outputPanel>
       </h:form>
      



      My problem is that after i add something to the list , although the onlistchanged event gets triggered the datalist does not get updated .

      Worth mentioning is that the fact that the #{pickList.produseSelectate} returns a List , not a String . Could this have anything to do with it ?

      my pickListBean is:

      public class PickListBean {
       private static final Logger logger = Logger.getLogger(PickListBean.class);
       private List<String> result;
       private List<SelectItem> produse;
       private List<Produs> listaProduse;
       private List<Produs> produseSelectate;
      
       public PickListBean() {
       }
      
       public List<String> getResult() {
       return result;
       }
      
       public void setResult(List<String> result) {
       this.result = result;
       }
      
       public Integer getItems() {
       if (result == null) {
       return 0;
       }
       logger.debug("Size :"+result.size());
       return result.size();
       }
      
       public List<SelectItem> getProduse() {
       if (produse == null) {
       Session s = HibernateUtil.getCurrentSession();
       listaProduse = (List<Produs>) s.createQuery("from Produs").list();
      
       produse = new ArrayList<SelectItem>();
      
       for (Produs p : listaProduse) {
       produse.add(new SelectItem(p.getCod(), p.getDenumire()));
       }
       }
       logger.debug("Returning :" + produse);
       return produse;
       }
      
       public void setProduse(List<SelectItem> f) {
       this.produse = f;
       }
       public List<Produs> getProduseSelectate(){
      
       produseSelectate = new ArrayList<Produs>();
       for ( Produs p : listaProduse){
       if (result != null && result.contains(p.getCod())){
       produseSelectate.add(p);
       }
       }
       logger.debug("getProduseSelctate :"+produseSelectate);
       return produseSelectate;
       }
       public void setProduseSelectate(List<Produs> s){
       this.produseSelectate = s;
       }
      }
      


      Any ideas would be highly apreciated