我创建了一个实现微调器的复合组件,我工作得很好,但是当我从 primefaces 2.2.1 更改为 primefaces 3.3.1 时,当我尝试使用 p:ajax 而不是 f:ajax 时,组件崩溃了所有页面。
这是组件:
<c:interface>
<c:attribute name="value" required="true"/>
<c:attribute name="fator" required="false" default="1"/>
<c:attribute name="required" required="false" default="false"/>
<c:attribute name="requiredMessage" required="false" default=""/>
<c:attribute name="validatorMessage" required="false" default="Não é um número válido!"/>
<c:attribute name="disabled" required="false" default="false"/>
<c:attribute name="title" required="false" default=""/>
<c:attribute name="width" required="false" default="100"/>
<c:attribute name="dinheiro" required="false" default="false"/>
<c:attribute name="local" required="false" default="pt-BR"/>
<c:attribute name="imediato" required="false" default="false"/>
<c:attribute name="onchange" required="false" default=""/>
<c:attribute name="onkeyup" required="false" default=""/>
<c:attribute name="max" required="false" default="-1"/>
<c:attribute name="min" required="false" default="0"/>
<c:attribute name="parametro" required="false" default=""/>
<c:attribute name="casasDecimais" required="false" default="2"/>
<c:attribute name="valueChangeListener" method-signature="void method(javax.faces.event.ValueChangeEvent)"
targets="spinner"/>
<c:attribute name="rendered" required="false" default="true"/>
<c:editableValueHolder name="#{cc.id}" targets="spinner"/>
<c:clientBehavior name="blur" default="true" event="blur"
targets="spinner"/>
<c:clientBehavior name="change" default="true" event="change"
targets="spinner"/>
</c:interface>
<c:implementation>
<h:outputStylesheet library="css" name="hrgiSpinner.css" target="head"/>
<h:outputScript library="js" name="jquery.formatCurrency-1.4.0.min.js" target="head"/>
<h:outputScript library="js" name="jquery.formatCurrency.pt-BR.js" target="head"/>
<h:outputScript library="js" name="hrgiSpinner.js" target="head"/>
<h:panelGroup layout="block" styleClass="hrgi-spinner" rendered="#{cc.attrs.rendered}">
<p:inputText id="spinner" value="#{cc.attrs.value}"
styleClass="hrgi-spinner-input editableField" disabled="#{cc.attrs.disabled}"
onchange="formatar(this,'#{cc.attrs.fator}','#{cc.attrs.local}','#{cc.attrs.dinheiro}','#{cc.attrs.max}','#{cc.attrs.min}','#{cc.attrs.casasDecimais}'); #{cc.attrs.onchange}"
required="#{cc.attrs.required}" requiredMessage="#{cc.attrs.requiredMessage}"
validatorMessage="#{cc.attrs.validatorMessage}" onkeyup="#{cc.attrs.onkeyup}"
title="#{cc.attrs.title}" immediate="#{cc.attrs.imediato}" style="width: #{cc.attrs.width}px;"
converterMessage="O valor informado não é um número.">
<f:attribute name="objeto" value="#{cc.attrs.parametro}"/>
</p:inputText>
<h:panelGroup layout="block" styleClass="hrgi-spinner-painel-botoes"
rendered="#{not cc.attrs.disabled}">
<div onmousedown="incrementar('#{cc.clientId}'+':spinner','#{cc.attrs.fator}','#{cc.attrs.local}','#{cc.attrs.dinheiro}','#{cc.attrs.max}','#{cc.attrs.min}','#{cc.attrs.casasDecimais}');"
class="hrgi-spinner-botao hrgi-spinner-botao-alto clearfix"/>
<div onmousedown="decrementar('#{cc.clientId}'+':spinner','#{cc.attrs.fator}','#{cc.attrs.local}','#{cc.attrs.dinheiro}','#{cc.attrs.max}','#{cc.attrs.min}','#{cc.attrs.casasDecimais}');"
class="hrgi-spinner-botao hrgi-spinner-botao-baixo clearfix"/>
</h:panelGroup>
<h:panelGroup layout="block"
styleClass="hrgi-spinner-painel-botoes hrgi-spinner-painel-botoes-desabilitados"
rendered="#{cc.attrs.disabled}">
<div class="hrgi-spinner-botao hrgi-spinner-botao-alto clearfix"/>
<div class="hrgi-spinner-botao hrgi-spinner-botao-baixo clearfix"/>
</h:panelGroup>
</h:panelGroup>
</c:implementation>
当我使用 f:ajax 时:
<hrgi:spinner id="aliquotaIpiItem" rendered="#{itemEmbrulhado.carregado}"
disabled="#{not modeloPopupLancamentoNF.lancamentoDanfe}"
value="#{controladorTabelaDinamicaItemNF.recuperarIPI(itemEmbrulhado).aliquota}"
dinheiro="false" fator="0.01" local="pt-BR" min="0.00" width="70"
parametro="#{itemEmbrulhado}">
<f:ajax render=":lancamentoNF:abasNF:painelItensNF :alerta" execute="@form"
event="blur" listener="#{controladorPopupLancamentoNF.validarAliquotasItemEAdicionar}"
onevent="definirFoco"/>
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" locale="#{cc.attrs.local}"
for="aliquotaIpiItem"/>
</hrgi:spinner>
当我使用 p:ajax 时:
<hrgi:spinner id="aliquotaIpiItem" rendered="#{itemEmbrulhado.carregado}"
disabled="#{not modeloPopupLancamentoNF.lancamentoDanfe}"
value="#{controladorTabelaDinamicaItemNF.recuperarIPI(itemEmbrulhado).aliquota}"
dinheiro="false" fator="0.01" local="pt-BR" min="0.00" width="70"
parametro="#{itemEmbrulhado}">
<p:ajax update=":lancamentoNF:abasNF:painelItensNF :alerta" process="@form"
event="blur" listener="#{controladorPopupLancamentoNF.validarAliquotasItemEAdicionar(itemEmbrulhado)}"
onsuccess="salvarFoco();" oncomplete="carregarFoco(); exibirPopupAlerta(xhr, status, args);"/>
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" locale="#{cc.attrs.local}"
for="aliquotaIpiItem"/>
</hrgi:spinner>
有人可以解释一下发生了什么吗?