hi
I m using primefacs (PrimeFaces-2.2.M1) and jsf 2.0 ..i m trying to implemented lazy loading .. at the inital time the data table is displaying properly , after clicking the NextPageLink the datatable is displaing the same content ,and getting exception like this
java.lang.ArithmeticException: / by zero
at org.primefaces.model.LazyDataModel.setRowIndex(LazyDataModel.java:62)
at javax.faces.component.UIData.setRowIndex(UIData.java:448)
at javax.faces.component.UIData.visitTree(UIData.java:1184)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIForm.visitTree(UIForm.java:333)
how can i solve this problem ?
at the inital time the load method is calling but from second time onwards (when i click the nextpagelink) the load method is not calling ..
problem with data table lazy loading primefaces-2.2. m1
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Does showcase work for you?
I also experience the same error:
In my case the pagination buttons are disabled but the first page is displayed properly without error messages. I tried with various values for "row" attribute in the markup, the first page displays the correct number of rows.
When I try to change the rows per page from the drop down (in the display), it is not working and the above error thrown.
"(0 of 0)" is always shown at the footer bar of the table when 1st page is displayed.
Component showcase is working properly.
(My M1SNAPSHOT is as of 3 Sep)
Code: Select all
SEVERE: java.lang.ArithmeticException: / by zero
When I try to change the rows per page from the drop down (in the display), it is not working and the above error thrown.
"(0 of 0)" is always shown at the footer bar of the table when 1st page is displayed.
Component showcase is working properly.
(My M1SNAPSHOT is as of 3 Sep)
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Snapshots are not supported and we can't replicate it on our end, we can start discussing this once this feature gets a release number so we can do proper tracking of issues, dates can't help for sure to keep track of things.
I have the same problem with Primefaces 2.2 M1 as well.
Last edited by MISS_DUKE on 08 Sep 2010, 10:07, edited 1 time in total.
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
in lazy data model class ..at inital time when i load lazy loading data table the pageSize come as what value i specied in row attribute in the datatable but when the secontd time pageSize coming as 0 and rowIndex -1. how can i resolve this ?
this setter method only throwing the following exception ..... java.lang.ArithmeticException: / by zero..........
public void setRowIndex(int rowIndex) {
this.rowIndex = (rowIndex % pageSize);
}
thanks
Maya
this setter method only throwing the following exception ..... java.lang.ArithmeticException: / by zero..........
public void setRowIndex(int rowIndex) {
this.rowIndex = (rowIndex % pageSize);
}
thanks
Maya
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Make sure your lazydatamodel has a scope wider than request. Or compare with showcase example until the user's guide is ready. Or you can help us by providing a case code which we can try to replicate.
When I changed my lazyDataModel to viewScope or SessionScope no errors thrown and rows per page drop down works properly.
But pagination buttons are still disabled, always shown (0 of 0) at the bottom.
But pagination buttons are still disabled, always shown (0 of 0) at the bottom.
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
My LazyModel implementation as follows
Code: Select all
import java.util.List;
import java.util.Map;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.primefaces.model.LazyDataModel;
@ManagedBean
@ViewScoped
public class Master2Backing extends LazyDataModel<Object> {
@EJB
SearchSession2 searchSession;
public Master2Backing() {
}
public LazyDataModel getLazyDataModel() {
this.setRowCount(searchSession.getSearchResultCount());
return this;
}
@Override
public List<Object> load(int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters) {
return searchSession.getSearchResult(first, pageSize);
}
}
Code: Select all
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class SearchSession2 {
@PersistenceContext(unitName = "myContext")
EntityManager em;
public List getSearchResult(int firstResult, int pageSize) {
List list = em.createNamedQuery("Me.search").setFirstResult(firstResult).setMaxResults(pageSize).getResultList();
return list;
}
public Integer getSearchResultCount() {
Object count = em.createNamedQuery("Me.count").getSingleResult();
return Integer.valueOf(((Long) count).intValue());
}
}
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 44 guests