webtier@glassfish.java.net

Re: [webtier] JSF ajax ui:repeat re-rendering

From: Joel Weight <digitaljoel_at_gmail.com>
Date: Thu, 5 Aug 2010 09:04:34 -0600

I'm not sure if it is supposed to work like that, but one way you likely
could get it to work would be to wrap the ui:repeat in an h:panelGroup and
then update the panelGroup in the render for f:ajax instead of the
ui:repeat.

Joel

On Thu, Aug 5, 2010 at 1:48 AM, Manuel <manuel_at_makumba.org> wrote:

> Hello,
>
> I'm trying to re-render a whole ui:repeat using f:ajax, but don't seem
> to manage.
>
> Given the following view code:
>
> <h:form id="f">
> <ul>
> <ui:repeat value="#{listBean.list}" var="first"
> id="bigList">
> <li><h:outputText id="out" value="#{first}" /></li>
> </ui:repeat>
> </ul>
> <h:commandButton value="Go">
> <f:ajax render="f:bigList" />
> </h:commandButton>
> </h:form>
>
> with the following bean:
>
> @ManagedBean
> public class ListBean {
> static int n = 0;
>
> public List<Object> getList() {
>
> List<Object> v = new ArrayList<Object>();
> v.add(n++);
> v.add(n++);
> v.add(n++);
> return v;
> }
>
> I do get a nice response to the POST query:
>
> <?xml version='1.0' encoding='UTF-8'?>
> <partial-response><changes><update id="f:bigList"><![CDATA[
> <li><span
> id="f:bigList:0:out">264</span></li>
> <li><span
> id="f:bigList:1:out">265</span></li>
> <li><span
> id="f:bigList:2:out">266</span></li>]]></update><update
>
> id="javax.faces.ViewState"><![CDATA[1643660172521007289:-1929025939115594533]]></update></changes></partial-response>
>
>
> However, the page is not updated. I do suspect that the <update
> id="f:bigList"> can't find a "f:bigList" element on the page to
> update, as ui:repeat does not render one (no span, div, or else is
> rendered around the child components). I tried wrapping the ui:repeat
> inside of a div that has as id "f:bigList", but that seems to mess up
> things more than anything else.
>
> Am I doing something wrong, or is this a bug?
>
> Thanks,
>
> Manuel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>