title: lazy loading no data in datatable
body: <p>I have a problem with lazy loading. Without lazyloading it is working fine but after lazy loading i get no data. I think there is a problem with my lazy data model creation.</p>
  
  <p>edit: What I found is lazy model's load method is not calling.</p>
  
  <p>Here is my datatable;</p>
  
  <pre><code>&lt;p:dataTable id="companiesDataTable"
                           var="company" value="#{myController.lazyCompanyDataModel}"
                           rowKey="#{company.uuid}"
                           lazy="true"
                           sortMode="multiple" rows="5" paginator="true"&gt;
  </code></pre>
  
  <p>My Spring Controller;</p>
  
  <pre><code>private LazyDataModel&lt;Company&gt; lazyCompanyDataModel;
  private List&lt;Company&gt; companyList;
  
  @Override
  public void init() {
      lazyCompanyDataModel = new LazyCompanyDataModel(companyList);
  
      selectedCompany = new Company();     
  
  }
  </code></pre>
  
  <p>My Data Model;</p>
  
  <pre><code>public class LazyCompanyDataModel extends LazyDataModel&lt;Company&gt; {  
  
  
  GenericService genericService;
  
  private List&lt;Company&gt; datasource;
  private int pageSize;
  private int rowIndex;
  private int rowCount;
  
  public LazyCompanyDataModel(List&lt;Company&gt; datasource) {  
      this.datasource = datasource;        
  }
  
  @Override
  public List&lt;Company&gt; load(int first, int pageSize, String sortField, SortOrder sortOrder, Map&lt;String,String&gt; filters) {
      datasource = genericService.getByTemplate(new Company(), first, pageSize,new Order(null,Order.convertSortOrder(sortField)) );
      setRowCount((int) genericService.getCountByTemplate(new Company()));
      return datasource;
  }
   @Override
  public boolean isRowAvailable() {
      if(datasource == null)
          return false;
      int index = rowIndex % pageSize ;
      return index &gt;= 0 &amp;&amp; index &lt; datasource.size();
  }
  
  @Override
  public Object getRowKey(Company company) {
      return company.toString();
  }
  
  @Override
  public Company getRowData() {
      if(datasource == null)
          return null;
      int index =  rowIndex % pageSize;
      if(index &gt; datasource.size()){
          return null;
      }
      return datasource.get(index);
  }
  
  @Override
  public Company getRowData(String rowKey) {
      if(datasource == null)
          return null;
     for(Company company : datasource) {
         if(company.toString().equals(rowKey))
         return company;
     }
     return null;
  }
  
  @Override
  public void setPageSize(int pageSize) {
      this.pageSize = pageSize;
  }
  
  @Override
  public int getPageSize() {
      return pageSize;
  }
  
  @Override
  public int getRowIndex() {
      return this.rowIndex;
  }
  
  @Override
  public void setRowIndex(int rowIndex) {
      this.rowIndex = rowIndex;
  }
  
  @Override
  public void setRowCount(int rowCount) {
      this.rowCount = rowCount;
  }
  
  @Override
  public int getRowCount() {
      return this.rowCount;
  }
  
  @Override
  public void setWrappedData(Object list) {
      this.datasource = (List&lt;Company&gt;) list;
  }
  
  @Override
  public Object getWrappedData() {
      return datasource;
  }
  </code></pre>
  
  <p>}  </p>