Jsf DonutChart未更新
您好,我使用的是PrimeFaces 5.2,我使用的是数据表的图表。在页面加载时,图表为空,仅在刷新时显示图表。在搜索时,图表不会再次更改,只是在刷新时或在新搜索时,会显示上一次搜索的图表。对不起我的英语。 我的JSF页面:Jsf DonutChart未更新,jsf,primefaces,Jsf,Primefaces,您好,我使用的是PrimeFaces 5.2,我使用的是数据表的图表。在页面加载时,图表为空,仅在刷新时显示图表。在搜索时,图表不会再次更改,只是在刷新时或在新搜索时,会显示上一次搜索的图表。对不起我的英语。 我的JSF页面: <h:form id="statisfationFilterForm"> <h:outputText value="#{msg['media.reports.filter.date.from']}" /> <p:calend
<h:form id="statisfationFilterForm">
<h:outputText value="#{msg['media.reports.filter.date.from']}" />
<p:calendar id="dateFrom"
value="#{statisfationController.model.currentSatisfation.filter.startDate}"
pattern="dd/MM/yyyy"/>
.
.
.
<p:commandButton value="#{msg['button.search']}"
ajax="true"
action="#{statisfationController.model.getLazyModel()}"
update=":statisfationTableForm"/>
<p:commandButton value="#{msg['button.clear']}"
ajax="true"
action="#{statisfationController.clear()}"
update=":statisfationTableForm :statisfationFilterForm"/>
</h:form>
<h:form id="statisfationTableForm">
<p:chart id="chart" type="donut"
model="#{statisfationController.model.donutModel}"
style="width:400px;height:300px" />
<p:dataTable value="#{statisfationController.model.lazyModel}"
.
.
.
.
.
.
我在datatable延迟加载上找到了答案:。我解决了将图表放在datatable之后并立即加载的问题。在getLazyModel函数之前加载datatable之前,以及在更新datatable之后加载函数组件之前,我是如何理解组件的。是的,我尝试过,但都是一样的。我还尝试从表单中移出,然后再次执行相同的操作。如果未在datatable load函数中填充,则可以正常工作,但我需要使用datatable值填充感谢尝试帮助我找到了我的答案:)
@PostConstruct
public void init() {
LOGGER.debug("Initialize 'satisfationModel' bean.");
try {
statisticsService.setClazz(E_CMS_STATISTICS_CROSSELER.class, Integer.class);
userInteractionService.setClazz(E_CMS_USER_INTERACTION.class, Integer.class);
satisfationDataModel = new DataGridModel<E_CMS_USER_INTERACTION>();
satisfationDataModel.setGridRendered(false);
currentSatisfation = new E_CMS_USER_INTERACTION();
currentSatisfation.setFilter(new UserSatisfactionReportFilter());
currentSatisfation.getFilter().setBenutzers(statisticsService.getAllBenutzers());
donutModel = new DonutChartModel();
} catch (Exception e) {
LOGGER.error("Exceptions while initializing 'customerstatisfation' bean!", e);
}
}
public LazyDataModel<E_CMS_USER_INTERACTION> getLazyModel(){
.
.
.
@Override
public List<E_CMS_USER_INTERACTION> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
.
.
.
List<E_CMS_USER_INTERACTION> list = response.getList();
donutModel = new DonutChartModel();
createDonutModels(list);
return list;
.
.
.
}