Domanda

Is there a way to process client listener after processing action listener in ADF ?

Following is my code snippet:

<af:commandLink text="Click Me" id="myLink"
                partialSubmit="true"
                actionListener="#{pageFlowScope.myBean.changeSelection}">
     <af:clientListener method="showMyTable" type="action"/>
</af:commandLink>
<af:outputText value="#{pageFlowScope.myBean.selectedValue}" id="ot1" 
               partialTriggers="myLink" />

My use case is: When I click on the command link, I have to change the display value of the output text and then have to show some other components using javascript (client listener).

Here my issue is: when I click on the command link, first the client listener is being processed. After processing the client listener, output text component is refreshing through action listener.

My requirement is to process action listener first, so that my output text component will be refreshed first. Then to process client listener to show other components.

È stato utile?

Soluzione

There is no way to make it work this way, since clientListener will work BEFORE by design.

However, you can achieve your goal just by launching your javascript request from actionListener directly.

Do something like this in the actionListener's method:

FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
service.addScript(fctx, "showMyTable();");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top