我正在尝试在 p:menuitem
上调用确认对话框:
<p:menuitem value="#{text['button.archive']}" actionListener="#{tasksbacking.archive}" icon="ui-icon-locked">
<p:confirm header="#{text['button.archive.confirm.header']}"
message="#{text['button.archive.confirm.message']}"
icon="ui-icon-alert"/>
</p:menuitem>
但根据 Primefaces 5 中的文档:
At the moment p:confirm is supported by p:commandButton and p:commandLink
有什么办法吗?
最佳答案
我找到了更好的解决方法 here .
用两个词 - 将 commandlink
包含到 menuitem
中,如下所示:
....
<p:menuitem>
<p:commandLink>
<p:confirm>
</p:confirm>
</p:commandLink>
</p:menuitem>
....
并且您可以在此设置中使用全局确认。它使用 PF 5.1 进行了测试。此外,它看起来很快就会在 PrimeFaces 中实现。 .
关于Primefaces p :menuitem with p:confirm not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25427249/