如何重新渲染< UI:重复>使用< F:AJAX渲染> [英] How to re-render <ui:repeat> using <f:ajax render>

查看:136
本文介绍了如何重新渲染< UI:重复>使用< F:AJAX渲染>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了由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;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆