我开发了一个视图来保存Child
对象。一切工作正常,但看到我在<p:dataTable>
我的其他对象,我总是不得不手动重新加载站点。按钮点击后网站不会重新加载
下面的<p:commandButton>
的代码将表单数据发送到我的控制器类。
<h:panelGrid columns="3">
<p:commandButton value="Save"
action="#{childController.doSaveChild}"
oncomplete="PF('childAddDialog').hide()"
update=":childForm"/>
</h:panelGrid>
我已经试过使用ajax="false"
,但它不起作用。
如何在点击保存按钮后重新加载站点?
UPDATE:
<p:dataTable>
从我view.xhtml:
<h:form id="childForm">
<p:dataTable id="childTable" var="child"
widgetVar="childTable" value="#{childController.children}"
paginator="true" rows="10" paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
{PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}
{Exporters}"
rowsPerPageTemplate="10,25,50">
<p:column headerText="Firstname"
filterBy="#{child.firstName}"
sortBy="#{child.firstName}" filterStyle="display:none">
<h:outputText value="#{child.firstName}"/>
</p:column>
<p:column headerText="Lastname"
filterBy="#{child.lastName}"
sortBy="#{child.lastName}"
filterStyle="display:none">
<h:outputText value="#{child.lastName}"/>
</p:column>
<p:column headerText="Birthday"
filterBy="#{child.birthday}"
sortBy="#{child.birthday}"
filterStyle="display:none">
<h:outputText value="#{child.birthday}"/>
</p:column>
</dataTable>
</form>
这里为视图提供孩子的方法:
public Collection<Child> getChildren(){
return children;
}
@PostConstruct
public void initList(){
setChildren(childService.getAllChildren());
}
您正试图让您的解决方法正常工作。我会专注于最初的问题。 –
你认为最初的问题是什么?我只想让网站自动重新加载。 – SteveOhio
正确的解决方案将是更新工作。你需要发布你的dataTable xhtml和相关的支持bean代码。 –