webtier@glassfish.java.net

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

From: Manuel <manuel_at_makumba.org>
Date: Fri, 13 Aug 2010 10:58:52 +0200

Hi,

since this really seems like an incoherent behavior to me, I filed an
issue with a test case at
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1773.

Cheers,

Manuel

On Fri, Aug 6, 2010 at 2:58 PM, Manuel <manuel_at_makumba.org> wrote:
> Hi Joel,
>
> thanks for the reply. Indeed this looks like a suitable workaround
> when the control is not part of the ui:repeat.
>
> However, I'd also like to re-render from a control inside of the
> ui:repeat, and there I can't access its parent as far as I know. So in
> the end I guess I'd still need this re-rendering to work somehow.
>
> Any suggestions (also as whether this is supposed to work - from my
> understanding of render=" " I guess it should) would be very welcome.
>
> Manuel
>
> On Thu, Aug 5, 2010 at 5:04 PM, Joel Weight <digitaljoel_at_gmail.com> wrote:
>> 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
>>>
>>
>>
>