p:graphicImage updated 3 times

UI Components for JSF
Post Reply
racadent
Posts: 14
Joined: 08 Sep 2010, 10:59

10 Nov 2010, 11:27

Hello,

I have a datatable component and when I select the row in the table I update chart with the new data. But the problem is that chart's method (getHours()) which returs data for the chart is called 3 times consecutively (so I have unnecessary 3 queries instead of one).

chart:

Code: Select all

<p:graphicImage id="chart" value="#{chartBean.hours}" cache="false" />
bean's method:

Code: Select all

public StreamedContent getHours() {
		StreamedContent chart = null;
		if (selectedService != null) {
			hours = report.getServiceGroupingReport(dateFrom, dateTo, selectedService.getServiceID(), "hh24");
			chart = createChart(hours, "hours");
			oldSelectedService = selectedService;
		}
		return chart;
	}
Thanks

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

10 Nov 2010, 20:05

See this thread:

http://primefaces.prime.com.tr/forum/vi ... f=3&t=3973

The getter methods shouldn't contain any logic.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 59 guests