title: Primefaces Datalist Pagination
body: <p>I'm using a datalist with Ajax pagination and the first page loads fine, showing 5 results. It knows I've got 3 pages worth of results, but when I click through to the second/third pages, I get an empty list. </p>
  
  <p>My model extends LazyDataModel and the first time my page loads, I can set a breakpoint on the load() method and I can see it's asking for results 1-5 which is great. But clicking on 'page 2' doesn't result in another call to the load method (although it does result in about 3 calls to my lazyDataModel field itself (just not the load method inside it). </p>
  
  <p>New to this and despite reading a lot and trying out various things, I can't understand quite how it should work. The showcase example doesn't seem quite 'complete' to me.</p>
  
  <p>Here's the most relevant bits of my code (I think). Sorry about the formatting:</p>
  
  <pre><code>@PostConstruct
  public void LoadData() {
    lazyModel = new LazyDataModel&lt;MessageboardThread&gt;() {
  
    @Override
    public List&lt;MessageboardThread&gt; load(int first, int pageSize, String sortField, SortOrder so, Map&lt;String, String&gt; map) {
      List&lt;MessageboardThread&gt; result = new ArrayList&lt;MessageboardThread&gt;();
  
      try {
          result = mbDao.findAll(pageSize, first);
      } catch (Exception ex) {
          ex.printStackTrace();
      }
      return result;
    }
  };
  getLazyModel().setRowCount(mbDao.count());
  getLazyModel().setPageSize(pageSize);
  }    
  </code></pre>
  
  <p>This method DOES get executed every time I click on next/prev page
  /**
   * @return the lazyModel
   */
  public LazyDataModel getLazyModel() {
      return lazyModel;
  }</p>
  
  <p>And this is my xhtml file</p>
  
  <pre><code>          &lt;p:dataList value="#{messageboardBean.lazyModel}" var="thread" id="threads"  
                  paginator="true" rows="5" effectSpeed="fast"  
                  paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
                  rowsPerPageTemplate="5,10,15" type="none"
                  paginatorPosition="bottom"&gt;  
  
                      &lt;f:facet name="header"&gt;  
                          Conversations 
                      &lt;/f:facet&gt;  
  
                      &lt;p:column&gt;  
                          &lt;h:outputText value="#{thread.title}" style="margin-left:10px" /&gt;  
                          &lt;br /&gt;  
                      &lt;/p:column&gt;  
              &lt;/p:dataList&gt; 
  </code></pre>
  
  <p>I'm stumped so really grateful for any help</p>
  
  <p>PS I put a @PostContruct annotation there because it seemed to be a good place to do the setup but it could be wrong, I haven't seen it on any other examples, but then I couldn't get any other examples to work either.</p>