为什么,当我使用ajax = true
时,操作按钮primefaces不起作用?
每当发生这种情况时,有人会遇到同样的情况吗?
<p:commandButton action="#{usuarioBean.insert()}" value="Gravar"
icon="/resources/img/accept.ico">
<p:confirm header="Confirmação" message="Tem Certeza??" icon="ui-icon-alert"/>
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes"
icon="ui-icon-check"/>
<p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no"
icon="ui-icon-close"/>
</p:confirmDialog>
在这种情况下,我需要两件事而且都不起作用。
答案 0 :(得分:0)
有时。某些组件可以互相阻止。例如按钮不起作用。您必须添加process =“ @ this”。您的按钮直接起作用。
<p:commandButton action="#{usuarioBean.insert()}" value="Gravar" **process="@this"**
icon="/resources/img/accept.ico">
<p:confirm header="Confirmação" message="Tem Certeza??" icon="ui-icon-alert"/>
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes"
icon="ui-icon-check"/>
<p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no"
icon="ui-icon-close"/>
</p:confirmDialog>
答案 1 :(得分:-1)
您应该查看commandButton中的“action”属性( action =“#{usuarioBean.insert}”)。
<p:commandButton action="#{usuarioBean.insert}" value="Gravar"
icon="/resources/img/accept.ico">
<p:confirm header="Confirmação" message="Tem Certeza??" icon="ui-icon-alert"/>
</p:commandButton>