在onclick事件之前执行p:commandLink动作? [英] Execute p:commandLink action before onclick event?
问题描述
我有一个p:commandLink
,它会在单击时启动一个对话框.此外,还有一个动作,必须在启动对话框之前执行,因为该对话框取决于该动作所填充的内容.
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.
如何在没有弹出 javascript的情况下启动弹出窗口之前执行操作?
How can I run the action before launching the popup without javascript?
<p:commandLink action="#{service.computePrefetch(_var)}" onclick="dlg.show()"/>
推荐答案
具有oncomplete属性和ajax update属性.
With the oncomplete attribute and the ajax update attribute.
<p:commandLink action="#{service.computePrefetch(_var)}" update="dlgId" oncomplete="dlg.show()"/>
执行顺序:
onclick->操作->更新->未完成
onclick->action->update->oncomplete
BalusC发布了详细的序列
BalusC posted a detailed sequence Execution order of events when pressing PrimeFaces p:commandButton
这篇关于在onclick事件之前执行p:commandLink动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!