[DataTable] Page ajax event causes NumberFormatException

UI Components for JSF
Post Reply
sroussy
Posts: 2
Joined: 01 Sep 2014, 15:45

16 Aug 2016, 15:46

Hi!
When I'm trying to put this event in a datable:

Code: Select all

<p:ajax event="page"  oncomplete="console.log('[debug] paginate')" process="@this"/>
It causes this exception:

Code: Select all

com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
GRAVE: java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.parseInt(Integer.java:615)
	at org.primefaces.component.datatable.DataTable.queueEvent(DataTable.java:776)
	at org.primefaces.behavior.ajax.AjaxBehaviorRenderer.decode(AjaxBehaviorRenderer.java:47)
	at javax.faces.component.behavior.ClientBehaviorBase.decode(ClientBehaviorBase.java:132)
It seems, in the DataTable.java

Code: Select all

 int first = Integer.parseInt(params.get(clientId + "_first"));
params.get(clientId + "_first") is null

If I change this evalution by first=0, then I have no error but strangely no pagination occurs on screen.

Anyone knows something about this ?

PF : 5.2.8
Mojarra : 2.2.13
Server : Tomcat 7
Java 7

luca.stancapiano
Posts: 27
Joined: 18 Jun 2018, 14:52

21 Jun 2018, 13:24

I have the same problem using primefaces 6.2 and 6.3-SNAPSHOT

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

27 Jun 2018, 16:50

Does your datatble actually support paging?

luca.stancapiano
Posts: 27
Joined: 18 Jun 2018, 14:52

02 Jul 2018, 15:37

yes, paginator=true

luca.stancapiano
Posts: 27
Joined: 18 Jun 2018, 14:52

02 Jul 2018, 18:19

on a first look , I see that the request parameters are fixed by a parameter: CLIENT_BEHAVIOR_RENDERING_MODE=UNOBSTRUSIVE, so the _first, _rows and _pagination request parameters are missed when the ajax call is sent to the server. When the click is started a mojarra function is started:

Code: Select all

mojarra.ab('j_idt51:postsList',event,'page',0,0,{'params':{'CLIENT_BEHAVIOR_RENDERING_MODE':'UNOBSTRUSIVE'}})
this function overrides the params, so the params.get(clientId + "_first") is null. Who call this function and why is started?

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

03 Jul 2018, 12:37

'mojarra.ab` looks like it is from an f:ajax. Sure you are not using that instead of a p:ajax?

luca.stancapiano
Posts: 27
Joined: 18 Jun 2018, 14:52

03 Jul 2018, 13:38

Yes, it was the problem. Thanks for the resolution

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 51 guests