问题描述
我已经实现了由Repeater创建一个列表:
I have implemented a list created by a repeater:
<ui:repeat value="#{projectData.paginator.list}" var="project">
<h:outputText value="#{project.title}" />
</ui:repeat>
和一个按钮,筛选我的名单:
and a Button that filters my list:
<h:commandLink action="#{overviewController.filterNew}">
<h:outputText value="Filter List" />
</h:commandLink>
那么,有没有一种简单的方法单击命令链接(使用AJAX)后,只呈现我的中继器: - )
So, is there an easy way to render only my repeater after clicking the command link (with AJAX) :-)
我试着以下内容:
<f:ajax render="repeater">
ui:repeat id="repeater" value="#{projectData.paginator.list}" var="project">
<h:outputText value="#{project.title}" />
</ui:repeat>
<f:ajax />
<h:commandLink action="#{overviewController.filterNew}">
<h:outputText value="Filter List" />
<f:ajax event="click" render="repeater"/>
</h:commandLink>
但没有奏效。
but that did not work..
<h:form>
ui:repeat id="repeater" value="#{projectData.paginator.list}" var="project">
<h:outputText value="#{project.title}" />
</ui:repeat>
<h:commandLink action="#{overviewController.filterNew}">
<h:outputText value="Filter List" />
<f:ajax event="click" render="repeater"/>
</h:commandLink>
</h:form>
也不起作用......也许我甲肝把操作方法(overviewController.filterNew)到AJAX标签?
doesn't work either... Maybe I hav to put the action method (overviewController.filterNew) into the ajax tag?
<f:ajax event="click" render="repeater">
<h:commandLink action="#{overviewController.filterEBus}">
<h:outputText value="EBusiness" />
</h:commandLink>
</f:ajax>
也不起作用!
Doesn't work either!
也许这是不可能重新解析中继?有没有像一个div标签或东西,可以重新呈现???另一个元素
Maybe it's not possible to rerender a repeater ? is there another element like a div tag or something that can be rerendered???
...
感谢您的帮助
推荐答案
在&LT; UI:重复&GT;
本身不产生任何HTML的输出。该&LT; F:AJAX渲染&GT;
期待一个ID,它是present在HTML DOM树。把它放在一个&LT; H:panelGroup中&GT;
与 ID
并引用它来代替
The <ui:repeat>
itself does not generate any HTML to the output. The <f:ajax render>
expects an ID which is present in the HTML DOM tree. Put it in a <h:panelGroup>
with an id
and reference it instead.
<h:form>
<h:panelGroup id="projects">
<ui:repeat value="#{projectData.paginator.list}" var="project">
<h:outputText value="#{project.title}" />
</ui:repeat>
</h:panelGroup>
<h:commandLink action="#{overviewController.filterNew}">
<h:outputText value="Filter List" />
<f:ajax execute="@form" render="projects" />
</h:commandLink>
</h:form>
这篇关于如何重新渲染&LT; UI:重复&GT;使用&LT; F:AJAX渲染&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!