AJAX request in DataTable reloads whole DataTable 13x

UI Components for JSF
Post Reply
jtichava
Posts: 4
Joined: 10 Oct 2011, 16:16

24 Oct 2011, 13:24

Hello,

I'm trying to use Row Selection in DataTable. I want to display data from row in a dialog, (almost) exactly as in this example: DataTable - Row Selection. Everything is working, but there is a problem. I supposed that there is some problem in my code, so I ran code from this example and there is the same problem. I'll talk about this example, now.

Data for DataTable are obtained by calling method getCars().
When somebody clicks on any button in generated DataTable, method getCars() from TableBean is called 13 times. (If I have 10 records in DataTable, method is called 13 times. If I have 20 records, method is called 13 times too.)

How can I change this behavior? I only want to set selectedCar and display it in a dialog.
I don't know, if it isn't a bug in Primefaces, because it's weird behavior, but i hope, that's only some settings are somewhere missing.

I'm using MyEclipse 9.1, Mojaara JSF 2.1.2, Jetty 7.1.6, Java 1.6.0_24, Firefox 7.0.1, Opera 11.51; tried on Primefaces 3.0 M2 and 3.0 M3.

Thanks.

jbn1981
Posts: 17
Joined: 10 May 2011, 13:00

24 Oct 2011, 14:13

Hi jtichava, did you get any solution? Same thing happens to me, the method specified in value="..." is executed several times instead of one. Thanks.
Primefaces 2.2.1 | Mojarra 2.0.4 | Tomcat 6

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

24 Oct 2011, 14:17

value="" should only be a value expression. In JSF you should not write logic into your getter.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

jtichava
Posts: 4
Joined: 10 Oct 2011, 16:16

24 Oct 2011, 14:36

I want to renew data on page from database on each refresh, so getter calls application layer which provides new data.
I understand, getter should return value, nothing else, but how can I renew data when page reloads?
Anyway, but why is getter called so many times?

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

24 Oct 2011, 14:40

you could use f:event with prerenderview.
The listener of this event could load your data on every request.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

jtichava
Posts: 4
Joined: 10 Oct 2011, 16:16

24 Oct 2011, 14:43

ok, thank you

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 48 guests