7 Replies Latest reply on May 3, 2007 9:39 AM by ed bras

    nested repeater not work?

    ed bras Newbie


      I am having problems nesting a repeater in a repeater.
      What I have is:
      the same kind of app as the repeater example whereby you can collapse and expand items.

      When I expand an item, I also have some list of properties that I need to show/modify. Therefore I use another repeater.
      However, when requesting the page where all this takes place, the application sees: "Caused by: java.lang.IllegalArgumentException: row is unavailable"

      What happens is that in the second repeater I need to know which item is selected so I request that from the first repeater by "this.repeater.getRowData()" During the request of this page, it's called often ofcourse and then all of a sudden the repeater's _rowKey property equals null and as such the error occours.

      Any idea how this comes ? and is it even possible to use nested repeaters?
      BTW: I also tried it with facelets repeater but then I get strange behavior, that is that the repeater shows "old" values that where already updated by using the same repeater :(

      Below piece of the code that contains the second repeater (it has some more stuff and input boxes but the code below gives the same error). The wizard.selectedMember calls the getRowData() on the first repeater.
      BTW: I am using a snapshot of 19 april.

       <a4j:repeat id="bla"

      I looked at it a bit closer and found

        • 1. Re: nested repeater not work?
          Sergey Smirnov Master

          The code snippet you provided does not help to catch the source of the problem. Please post more code with two nested repeaters at least. The beans' structure might be useful as well.

          • 2. Re: nested repeater not work?
            ed bras Newbie

            I wanted to save you all the text....
            Ok, here it is. I made a little test page to reproduce the error that makes it a bit more compact.
            Below you find the xhtml form and the last part of the strack trace.

            Please let me know what you need more ?

            I hope you see anyting.

            The stack trace:

            Caused by: javax.faces.el.EvaluationException: Bean: bla.ViewSubscriptionsOverviewDefault, property: memberSelected
             at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:461)
             at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
             at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
             at com.sun.el.parser.AstValue.getValue(AstValue.java:118)
             at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
             at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
             at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
             ... 58 more
            Caused by: java.lang.IllegalArgumentException: row is unavailable
             at javax.faces.model.ListDataModel.getRowData(ListDataModel.java:66)
             at org.ajax4jsf.ajax.repeat.SequenceDataModel.getRowData(SequenceDataModel.java:147)
             at org.ajax4jsf.ajax.repeat.UIDataAdaptor.getRowData(UIDataAdaptor.java:230)
             at bla.ViewEntityRepeaterWizard.getSelectedEntity(ViewEntityRepeaterWizard.java:205)
             at bla.ViewSubscriptionsOverviewDefault.getMemberSelected(ViewSubscriptionsOverviewDefault.java:197)

            The xhtml:
            <jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page"
             <table cellpadding="0" cellspacing="0" class="wizardListTable">
             <a4j:repeat binding="#{wizardList.repeater}"
             ajaxKeys="#{wizardList.updateKeys}" value="#{wizardList.list}"
             <td class="wizardListExpandCell">
             <a4j:commandLink value="+/-" action="#{wizardList.selectItem}"
             reRender="details" limitToList="true" immediate="true">
             <td class="wizardListNestedCell">
             <h:panelGroup id="details">
             <!-- BEGIN: The Collapsed part -->
             <h:panelGroup rendered="#{not wizardList.selected}">
             <!-- END: The Collapsed part -->
             <!-- BEGIN: The Expanded part -->
             <h:panelGroup rendered="#{wizardList.selected}">
             value="#{uProp.userProperty.userPropertyName.name}" />
             <!-- END: The Expanded part -->

            • 3. Re: nested repeater not work?
              ed bras Newbie

              Yeee, sometimes I "can solve" something myself...

              I solved it by basicaly just checking if the row of the repeater is available. If not just returing null and deal with it...

              I stil find it strange that the row isn't available.. but I found out that sometimes it's better no try to understand everything yet.... of JSF.. ;)

              • 5. Re: nested repeater not work?
                Sergey Smirnov Master

                you need to replace h:form with a4j:form at least.

                • 6. Re: nested repeater not work?
                  ed bras Newbie

                  But I use h:form as you can see in the above...

                  • 7. Re: nested repeater not work?
                    ed bras Newbie

                    Owww.. sjit... sorry.. I was doing toooo many things at the same time... And didn't read your post wel..