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" />
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;
}