Skip to main content

[webtier] JSF ajax ui:repeat re-rendering

3 replies [Last post]
Anonymous

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:

with the following bean:

@ManagedBean
public class ListBean {
static int n = 0;

public List getList() {

List v = new ArrayList();
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'?>
264

  • 265
  • 266
  • ]]>

    However, the page is not updated. I do suspect that the 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@glassfish.dev.java.net
    For additional commands, e-mail: webtier-help@glassfish.dev.java.net

    Reply viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.
    Joel Weight

    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 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:
    >
    >
    >

      > > id="bigList">
      >
    • >
      >

    >
    >
    >

    >
    >
    > with the following bean:
    >
    > @ManagedBean
    > public class ListBean {
    > static int n = 0;
    >
    > public List

    getList() { > > List v = new ArrayList(); > v.add(n++); > v.add(n++); > v.add(n++); > return v; > } > > I do get a nice response to the POST query: > > >
  • id="f:bigList:0:out">264
  • >
  • id="f:bigList:1:out">265
  • >
  • id="f:bigList:2:out">266
  • ]]>
    > id="javax.faces.ViewState">
    > > > However, the page is not updated. I do suspect that the 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@glassfish.dev.java.net > For additional commands, e-mail: webtier-help@glassfish.dev.java.net > > [att1.html]
    Manuel

    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 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 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:
    >>
    >>
    >>        

      >>                 >> id="bigList">
      >>                        
    • >>                
      >>        

    >>        
    >>                
    >>        

    >>
    >>
    >> with the following bean:
    >>
    >> @ManagedBean
    >> public class ListBean {
    >>    static int n = 0;
    >>
    >>    public List

    getList() { >> >>        List v = new ArrayList(); >>        v.add(n++); >>        v.add(n++); >>        v.add(n++); >>        return v; >> } >> >> I do get a nice response to the POST query: >> >> >> >                                
  • > id="f:bigList:0:out">264
  • >>                                
  • > id="f:bigList:1:out">265
  • >>                                
  • > id="f:bigList:2:out">266
  • ]]>
    > >> id="javax.faces.ViewState">
    >> >> >> However, the page is not updated. I do suspect that the > 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@glassfish.dev.java.net >> For additional commands, e-mail: webtier-help@glassfish.dev.java.net >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: webtier-help@glassfish.dev.java.net
    Manuel

    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 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 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 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:
    >>>
    >>>
    >>>        

      >>>                 >>> id="bigList">
      >>>                        
    • >>>                
      >>>        

    >>>        
    >>>                
    >>>        

    >>>
    >>>
    >>> with the following bean:
    >>>
    >>> @ManagedBean
    >>> public class ListBean {
    >>>    static int n = 0;
    >>>
    >>>    public List

    getList() { >>> >>>        List v = new ArrayList(); >>>        v.add(n++); >>>        v.add(n++); >>>        v.add(n++); >>>        return v; >>> } >>> >>> I do get a nice response to the POST query: >>> >>> >>> >>                                
  • >> id="f:bigList:0:out">264
  • >>>                                
  • >> id="f:bigList:1:out">265
  • >>>                                
  • >> id="f:bigList:2:out">266
  • ]]>
    >> >>> id="javax.faces.ViewState">
    >>> >>> >>> However, the page is not updated. I do suspect that the >> 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@glassfish.dev.java.net >>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net >>> >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: webtier-help@glassfish.dev.java.net