3 Replies Latest reply on Oct 5, 2011 12:55 PM by h2g2

    could not send attribute via a4j:support in extendedDataTable

    Satya K Newbie

      Hi All,


      I use rich:extendedDataTable to display the data and generate the double click event of table rows.


      For dblclick event, I have used a4j:supoport and f:attribute to pass the clicked object.


      Here is the table code :


                          value="#{testplannerBean.testSteps}" var="teststep"
                              <h:panelGroup style="width: 100%;">
                                  <h:graphicImage value="../../images/iconDelete.gif" styleClass="menuImages" rendered="#{teststep.status.deletable}">
                                      <a4j:support event="onclick" reRender="idTestStepsTbl"
                                          <f:attribute name="delete" value="#{teststep}"/>
                                  <h:outputText value="#{teststep.name}"/>
                          <a4j:support event="ondblclick"
                              <f:attribute name="load" value="#{teststep}"/>


      The passed object at the backing bean is null... the same a4j:support, if I change as below :


                          <a4j:support event="ondblclick"
                              <f:attribute name="load" value="someDummyStringValueRatherThanObject"/>


      I am able to get it as string. Why is it that the var="teststep" is going out of the context?


      Also I have used the same way in the above code to pass the object whenever a deleteIcon is clicked, that really works as expected.




        • 1. Re: could not send attribute via a4j:support in extendedDataTable
          h2g2 Newbie

          I may be wrong but I think the actionListener is invoked in a phase that happens before the UPDATE_MODEL_VALUES one, and thus the object is not set yet.... the problem is that it would not explain why it is set when you set it as a string...


          Then, in order to ensure it is right, you can try to retrieve "by force" from the listener , eg that way :





          If you can't get it that way, you could also try to postpone the event in order to manage it at a later phase (see below for an example), or eventually use an action instead of an action listener.


          Example with the postpone method :

          public final void valueChangeListener(final ValueChangeEvent event) {
                  final PhaseId phaseId = event.getPhaseId();
                  if (phaseId.equals(PhaseId.ANY_PHASE)) {
                  } else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES)) {
                            final Object object=event.getNewValue(); 
                            ... etc.

          Alternatively, you could try using a <f:SetPropertyListener> instead of an <f:attribute>

          That way actually :


                          target="#{testplannerBean.currentItem}" />


          Hope this will help you find your problem

          • 2. Re: could not send attribute via a4j:support in extendedDataTable
            Satya K Newbie

            No..That didnt work.


            I replaced f:attribute with something like :


            <f:setPropertyActionListener value="#{teststep}" target="#{testplannerBean.selectedTestStep}"/>


            It goes to setter method but the teststep is still null. Hope there is otehr way to do this

            • 3. Re: could not send attribute via a4j:support in extendedDataTable
              h2g2 Newbie

              I tried the same in some piece of code I have running a rich:DataTable.

              I don't know if it is also suited to the extended version, but this may work:

                <rich:dataTable ... >
                          <a4j:support event="onRowDblClick" action="#{myBean.testRowDblClick}">
                              <f:setPropertyActionListener value="#{varTest}" target="#{myBean.currentItem}" />


              I tried first with an action event and a ondblclick event but this did not work (null object like you).

              I then replaced the actionEvent with an action, but this just did not trigger the action. Then I changed from ondblclick to onRowDblClick and this eventually worked (currentItem was always ok).


              Hope this will do it now!