2 Replies Latest reply on Mar 29, 2012 4:54 AM by anisj1m

    walk method called manytimes for the first time

    anisj1m

      Hi,

       

      I extended ExtendedDataModel in order to face to the problem of the lazy pagination, but I am having this problem : I am loding the data inside the method walk, and for the first time when I click on search the walk method is called 3 times, but after that it is called just once:

      this is the method walk

       

      @Override
          public void walk(FacesContext fc, DataVisitor dv, Range range, Object o) {
              SequenceRange sr = (SequenceRange) range;
              int firstRow = sr.getFirstRow();
              int numbersRows = sr.getRows();
              Manager manager = new Manager();
             data = manager.loaddata();
              for (Declaration dec : data) {
                        try {
                                  wrappedData.put(dec.getId(), dec);
                                              dv.process(fc,dec.getId(), o);
                                    } catch (IOException e) {
                                              e.printStackTrace();
                                    }
                          }
          }
      
      

      and this is the method getRowData :

       

       @Override
          public Declaration getRowData() {
      
              //return data.get(rowKey);
                    return wrappedData.get(rowKey);
          }
      
      

      Thanks in advance

        • 1. Re: walk method called manytimes for the first time
          anisj1m

          any idea please?

          here how i use the dataTable :

          <h:form>
          <rich:dataTable id="pData" value="#{bean.model}" var="X" rows="10">
          </rich:dataTable>
          
          <a4j:commandButton value="Search 4aj" reRender="pData"></a4j:commandButton>
          </h:form>
          
          • 2. Re: walk method called manytimes for the first time
            anisj1m

            Finaly i found the problem;

            I had to create a new form for the button, so the a4j will be submitted and the dataTable will be rendered.

             

             

            <h:form>
            <rich:dataTable id="pData" value="#{bean.model}" var="X" rows="10">
            </rich:dataTable>
            </h:form>
            
            <a4j:form>
            <a4j:commandButton value="Search 4aj" reRender="pData"></a4j:commandButton>
            </a4j:form>