我正在尝试在复合commandButton中添加p:confirm,但是会发出以下错误:
<p:confirm> Composite component does not support event null
当我更改为普通的p:commandButton时,它会起作用。
此外,当直接在复合命令链接(完全具有相同的属性)中使用相同的p:confirmDialog(全局)时,它也可以工作。
用法示例:
<myCompositeSuite:commandButton id="buttonId"
action="#{beanController.action}">
<p:confirm
header="Confirm"
message="Do you confirm this action?"
icon="ui-icon-alert" />
</myCompositeSuite:commandButton>
复合组件示例(我尝试过的内容在注释中):
<cc:interface name="commandButton">
<cc:attribute name="rendered" default="true" />
<cc:attribute name="value" default="Button" />
<cc:attribute name="title" />
<cc:attribute name="style" />
<cc:attribute name="styleClass" />
<cc:attribute name="disabled" default="false" />
<cc:attribute name="ajax" default="false" />
<cc:attribute name="process" />
<cc:attribute name="onclick" />
<cc:attribute name="action" targets="myCompositeButton" />
<cc:attribute name="immediate" default="false" />
<cc:attribute name="oncomplete" />
<cc:attribute name="update" />
<cc:actionSource name="command" targets="myCompositeButton" />
<cc:clientBehavior name="click" targets="myCompositeButton" event="click" />
<!-- <cc:clientBehavior name="confirm" targets="myCompositeButton" event="null" /> -->
<!-- <cc:clientBehavior name="null" targets="myCompositeButton" event="null" /> -->
</cc:interface>
<cc:implementation>
<p:commandButton id="myCompositeButton"
rendered="#{cc.attrs.rendered}"
value="#{cc.attrs.value}"
title="#{cc.attrs.title}"
immediate="#{cc.attrs.immediate}"
styleClass="#{cc.attrs.styleClass}"
style="#{cc.attrs.style}"
disabled="#{cc.attrs.disabled}"
onclick="#{cc.attrs.onclick};"
oncomplete="#{cc.attrs.oncomplete};"
ajax="#{cc.attrs.ajax}"
process="#{cc.attrs.process}"
update="#{cc.attrs.update}">
<cc:insertChildren />
</p:commandButton>
</cc:implementation>
我正在使用jsf 2.3版和primefaces 6.2版。