/ by zero in CalculatePage

UI Components for JSF
Post Reply
Anthony
Posts: 33
Joined: 28 Nov 2011, 23:34

28 Nov 2011, 23:40

Hi,

I'm new to Primefaces and doesn't look like I'm off to a good start. I've installed the jars and put in a dataTable, which seems to work ok, until there's no rows. This seems to break the pagination, I've debugged it and it looks like it trys to divide by the amount of rows no matter what (if pagination is on) :

java.lang.ArithmeticException: / by zero
at org.primefaces.component.api.UIData.calculatePage(UIData.java:112)
at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:185)
at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:97)

Is this a known bug, am I missing something?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Nov 2011, 23:42

Can you post your p:dataTable code?

Also please read forum guide and state your environment. We don't know which version you are using.

Anthony
Posts: 33
Joined: 28 Nov 2011, 23:34

29 Nov 2011, 00:59

Sorry, I'm Mojarra 2.1.4, PF 3.0M4, the codes about as simple as it gets, loooks like this will happen with any configuration that returns 0 rows, I've tried it with the lazy model too :

Code: Select all

<p:dataTable value="#{ backingPage.mainTblCom.recordArray }" var="tableBean"  paginator="true"
			paginationAlwaysVisible="false" 
			rowsPerPageTemplate="5,10,15" >
			<p:column style="width:35px;text-align:center">
				<h:commandLink action="#{ backingPage.mainTblCom.selectBean }">
					<span id="editImage" /> 
				</h:commandLink>
			</p:column>
			<p:column>
				<f:facet name="header">Short Postcode</f:facet>
				#{tableBean.shortPostcodeStr}
			</p:column>
			<p:column width="24px">
					<aplos:deleteBean rendered="#{tableBean.deletable}"></aplos:deleteBean>
			</p:column>
		</p:dataTable>
Thanks for the lighting quick response btw.

Anthony
Posts: 33
Joined: 28 Nov 2011, 23:34

29 Nov 2011, 01:17

Hi,

I've added the rows field and it now works. In debugging I thought rows referred to the amount of returned rows, 0 seems an unfortunate default for this variable,

All the best,

Anthony.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 37 guests