4

I have a p:commandLink which launches a dialog on click. Further there is an action, which must be executed before launching the dialog, as the dialog depends on the content the action populates.

How can I run the action before launching the popup without javascript?

<p:commandLink action="#{service.computePrefetch(_var)}" onclick="dlg.show()"/>
0

1 Answer 1

21

With the oncomplete attribute and the ajax update attribute.

<p:commandLink action="#{service.computePrefetch(_var)}" update="dlgId" oncomplete="dlg.show()"/>

Execution order:

onclick->action->update->oncomplete

BalusC posted a detailed sequence Execution order of events when pressing PrimeFaces p:commandButton

1
  • its not working in my case here is my code <h:commandLink title="File" action="#{service.fetchDetail(row.sNo)}" update="DlgId" oncomplete="PF('Dlg').show()" />
    – Hassan
    Commented Oct 6, 2015 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.