10 Replies Latest reply on Jul 10, 2007 4:36 AM by Alexander Belov

    a4j:support doen't work inside UIData

    Alexander Belov Novice

      I have javascript event on row inside UIData component. On this event ajax submit by support component is occured.

      It fires script like:

      A4J.AJAX.Submit('_viewRoot','includeStartPage:include:simple',event,{'eventsQueue':'editRowQueue','parameters':{'includeStartPage:include:simple:tableId:0:editDataFromTable':'includeStartPage:include:simple:tableId:0:editDataFromTable'} ,'actionUrl':'/KE/ke.jsf','oncomplete':function(request,event,data){...');}},'ignoreDupResponses':true,'affected':['...'] } )


      But action method is not called. I think it's because component with id: "includeStartPage:include:simple:tableId:0:editDataFromTable" cannot be founded. I tryed to redefine getClientId() method of UIData to not add rowIndex in clientId. And everything works great this way.

      But I think that my workaround of this problem is not very good, besause this way UIData component doesn't support specification.
      Could you resolve this problem at ajax4jsf library? To tell the truth, I can't see other decission.

        • 1. Re: a4j:support doen't work inside UIData
          Ilya Shaikovsky Master

          please provide page code. And libraries versions.

          • 2. Re: a4j:support doen't work inside UIData
            Alexander Belov Novice

            I always use the latest version of ajax4jsf. But I had this problem with ajax4jsf 1.1.1 too.

            There is a code:

            <h:form id="testForm">
             <a:advancedTable value="#{simpleBean.selectItems}" var="testItem"
             id="testTable" styleClass="grid" selectPageMode="single"
             cycledCursor="false" selectMode="single">
             <h:column>
             <h:outputText value="#{testItem.label}"/>
             </h:column>
             <h:column>
             <h:inputText value="#{testItem.value}"/>
             </h:column>
             <a4j:support action="#{simpleBean.simpleAction}" reRender="testForm" limitToList="true" event="rowOndblclick"/>
             </a:advancedTable>
             </h:form>


            advancedTable is a UIData component with custom javascript. Event 'rowOndblclick' is fired then there is a double click on row.

            • 3. Re: a4j:support doen't work inside UIData
              Ilya Shaikovsky Master

              Please look to a4j:log to check the warnings and errors here. And use phaseTracker.jar to output the Lifecycle messages to the console.

              And please do not reRender the form element. Wrap the content need to be reRendered to outputPanel and reRender the panel.

              • 4. Re: a4j:support doen't work inside UIData
                Alexander Belov Novice

                Ok, now I have phaseTracker and I can see, that all phases are going right. There are only one error in a4j:log. Ajax4jsf cannot update content of the page because where are no data in response to replase page content. I have the following response:

                ...<body><div xmlns:rich="http://richfaces.ajax4jsf.org/rich"></div><meta name="Ajax-Update-Ids" content="" /><span id="ajax-update-ids"><input type="hidden" name="jsf_sequence" value="1" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1:j_id20" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body>


                Action method is not called this way.

                Code of the page:
                <h:form id="testForm">
                <a4j:outputPanel id="testOutputPanel" layout="block">
                <a:advancedTable value="#{simpleBean.selectItems}" var="testItem"
                 id="testTable" styleClass="grid" selectPageMode="single"
                 cycledCursor="false" selectMode="single">
                <h:column>
                <h:outputText value="#{testItem.label}"/>
                </h:column>
                <h:column>
                <h:inputText value="#{testItem.value}"/>
                </h:column>
                <a4j:support action="#{simpleBean.simpleAction}" reRender="testOutputPanel" limitToList="true" event="rowOndblclick"/>
                </a:advancedTable>
                </a4j:outputPanel>
                </h:form>
                


                But I see the following in script:

                A4J.AJAX.Submit('_viewRoot','includeStartPage:include:testForm',event,{'parameters':{'includeStartPage:include:testForm:testTable:4:j_id93':'includeStartPage:include:testForm:testTable:4:j_id93'} ,'actionUrl':'/KE/ke.jsf','affected':['testOutputPanel'] } )


                It seems, that there is no full clientId for outputPanel component.

                I tried to use binding it to managed bean and get it's clientId for using in reRender attribute.

                This way I have the following error:
                Caused by: java.lang.IllegalArgumentException: includeStartPage
                at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:588)
                at org.ajax4jsf.framework.renderer.AjaxRendererUtils.buildEventOptions(AjaxRendererUtils.java:279)
                at org.ajax4jsf.framework.renderer.AjaxRendererUtils.buildOnEvent(AjaxRendererUtils.java:171)
                at org.ajax4jsf.ajax.UIAjaxSupport.getEventString(UIAjaxSupport.java:115)
                at org.ajax4jsf.framework.ajax.EventValueBinding.getValue(EventValueBinding.java:92)

                includeStartPage is a4j:include component.

                I see that this exception is occured when attibute limitToList exists. I try to remove limitToList and reRender attributes. This way I have the same empty response as earlier.

                Any ideas?


                • 5. Re: a4j:support doen't work inside UIData
                  Ilya Shaikovsky Master

                  could you please send me your case directly to run it on my side?

                  • 6. Re: a4j:support doen't work inside UIData
                    Alexander Belov Novice

                    Have you received my letter?

                    • 7. Re: a4j:support doen't work inside UIData
                      Ilya Shaikovsky Master

                      yes. I've answered with reply and investigate your code today. Thanks.

                      • 8. Re: a4j:support doen't work inside UIData
                        Ilya Shaikovsky Master

                        Ok. We've investigated your code. The problem is that support decodes wrong in your case. Explore please UIDataTable class from Rich Faces datatable project to look up the difference.

                        In your case support decodes ones and will not be found later. But in Rich Faces dataTable it decodes for every row.

                        • 9. Re: a4j:support doen't work inside UIData
                          <todo> <todo> Newbie

                          Thank you for your help.

                          • 10. Re: a4j:support doen't work inside UIData
                            Alexander Belov Novice

                            It seems a little bug. Last post is mine, but I am not "rsinus". :-)