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()"/>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
membersound
  • 81,582
  • 193
  • 585
  • 1,120

1 Answers1

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

Community
  • 1
  • 1
djmj
  • 5,579
  • 5
  • 54
  • 92