Rerenderizar rich:modalPanel

5 respostas
C
Boa noite amigos.

Preciso de ajuda, tenho um a4j:commandButton e preciso que quando clicar nele abra um modalPanel com uma mensagem de confirmação antes de excluir o dado. Eu tentei de todas as formas mas o modalPanel não aparece. Vejam a últimma alternativa que tentei:

<a4j:commandButton id=“ExcluitTipoCombustivel” image=“imagens/delete.gif” styleClass=“deletar”  reRender=“pnlVisualizarCadastroCombustivel, edtbCombustivel,                opnlConfirmation, confirmation”>

<rich:componentControl for=“confirmation” attachTo=“ExcluitTipoCombustivel” operation=“show”    event=“onclick”/>

<f:setPropertyActionListener target="#{TipoCombustivelMBean.selectedTipoCombustivel}" value="#{item}"/>

</a4j:commandButton>

Por favor, quem poder me ajudar eu agradeço…

Abraço.

5 Respostas

andresf

Cara, tenta colocar o código abaixo no onclik do seu botao…

onclick="Richfaces.showModalPanel('idDoModal')"

Abraço

C
Cara eu coloquei o código que você sugeriu e o botao ficou assim:

<a4j:commandButton id=“ExcluitTipoCombustivel”

image=“imagens/delete.gif” styleClass=“deletar”

reRender=“pnlVisualizarCadastroCombustivel, edtbCombustivel, opnlConfirmation, confirmation”

onclick=“Richfaces.showModalPanel(‘confirmation’)”>

<f:setPropertyActionListener target="#{TipoCombustivelMBean.selectedTipoCombustivel}" value="#{item}"/>

</a4j:commandButton>

Mas não renderizou. Alguma outra sugestão???

Abração.

andresf

Tenta tirar o “confirmation” do rerender…

E me manda o código do seu rich:modal…

Esta gerando algum erro?

C
O button ficou assim:

<a4j:commandButton id=“ExcluitTipoCombustivel”

image=“imagens/delete.gif” styleClass=“deletar”

reRender=“pnlVisualizarCadastroCombustivel, edtbCombustivel, opnlConfirmation”

onclick=“Richfaces.showModalPanel(‘confirmation’)”>

<f:setPropertyActionListener target="#{TipoCombustivelMBean.selectedTipoCombustivel}" value="#{item}"/>

</a4j:commandButton>
E o modalPanel é:

<rich:modalPanel id=“confirmation”

autosized=“false”

resizeable=“false”

rendered="#{TipoCombustivelMBean.mostrarMensagemSelTodos}"

width=“350” height=“150”>

<f:facet name=“header”>Projeto Modelo</f:facet>

<h:panelGrid>

<h:panelGrid  columns=“2”>

<h:graphicImage value="/imagens/alerta_40x40.png" />

<h:outputText id=“optLabelMsgConfirmar” value="#{msgs.optLabelMsgConfirmar}" style=“FONT-SIZE: large;” />

</h:panelGrid>

<h:panelGroup>

<a4j:commandButton id=“cbtOK” value="#{msgs.cbtOK}"

onclick="#{rich:component(‘confirmation’)}.hide();submit();return false"/>

<a4j:commandButton id=“cbtCancelar” value="#{msgs.cbtCancelar}" onclick="#{rich:component(‘confirmation’)}.hide();return false" />

</h:panelGroup>

</h:panelGrid>

</rich:modalPanel>

Ele esta detro de um a4j:outputPanel, mas igual não abre. Não da nenhum erro.

Obrigado pela ajuda.

C
Cara consegui fazer o bedito Button chamar o modalPanel. O commandButton  ficou assim:

<a4j:commandButton id=“clkExcluitTipoCombustivel” image=“imagens/delete.gif” styleClass=“deletar”>

<rich:componentControl for=“confirmation” attachTo=“clkExcluitTipoCombustivel” operation=“show” event=“onclick”/>

<f:setPropertyActionListener target="#{TipoCombustivelMBean.selectedTipoCombustivel}" value="#{item}"/>

</a4j:commandButton>
E o modelPanel  ficou assim:

<rich:modalPanel id=“confirmation” width=“350” height=“150”>

<f:facet name=“header”>

<h:outputText value="#{msgs.optMsgConfirmacao}" />

</f:facet>

<h:panelGrid>

<h:panelGrid  columns=“2”>

<h:graphicImage value="/imagens/alerta_40x40.png" />

<h:outputText id=“optLabelMsgConfirmar” value="#{msgs.optLabelMsgConfirmar}" style=“FONT-SIZE: large;” />

</h:panelGrid>

<h:panelGroup>

<a4j:commandButton id=“cbtOK” value="#{msgs.cbtOK}"

action="#{TipoCombustivelMBean.doRemoveTipoCombustivel}">

<f:setPropertyActionListener target="#{TipoCombustivelMBean.selectedTipoCombustivel}" value="#{item}"/>

</a4j:commandButton>

<a4j:commandButton id=“cbtCancelar” value="#{msgs.cbtCancelar}" onclick="#{rich:component(‘confirmation’)}.hide();return false" />

</h:panelGroup>

</h:panelGrid>

</rich:modalPanel>

Obrigado pela atenção, quando precisar estamos ai.
Abraço.

Criado 3 de março de 2011
Ultima resposta 7 de mar. de 2011
Respostas 5
Participantes 2