本文介绍了在 onclick 事件之前执行 p:commandLink 操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 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 更新属性.

With the oncomplete attribute and the ajax update attribute.

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

执行顺序:

onclick->action->update->oncomplete

onclick->action->update->oncomplete

BalusC 贴出详细序列 按 PrimeFaces p 时事件的执行顺序:commandButton

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

这篇关于在 onclick 事件之前执行 p:commandLink 操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 22:39