0

I have one problem

I´m using one modal to get informations and put in a datatable.

<rich:popupPanel id="panelorcamento" domElementAttachment="form" modal="true" width="600" height="500" zindex="2" show="#{demandasMB.mostraOrcamento}" showWhenRendered="#{demandasMB.mostraOrcamento}">

In my action to show modal I´m using:

                        <h:commandButton value="Incluir UF">
                        <f:ajax render="panelorcamento" 
                            event="click"
                            listener="#{demandasMB.incluirOrcamento()}"
                            execute="ufs"/>
                    </h:commandButton>

My code in my MB is:

    public void incluirOrcamento(){
    orcamentoSelecionado = new Orcamentos();

    if(ufSelecionada.getCnmuf()==null){
        orcamentoSelecionado.setUfs(ufsint.recuperaUnico(ufSelecionada));
    }else{
        orcamentoSelecionado.setUfs(ufSelecionada); 
    }

    orcamentoSelecionado.setAutor(solicitante);
    orcamentoSelecionado.setDatacadastro(Calendar.getInstance());

    acrescentaAnosAoOrcamento();

    showOrcamento();
}

and ShowOrcamento is:

    public void showOrcamento(){
    mostraOrcamento=true;
}

It´s working. My modal open without problem.

Into my modal I have one button to hide my modal:

    public void hideOrcamento(){
    orcamentoSelecionado = new Orcamentos();
    mostraOrcamento=false;
}

and a button to hide is:

                        <h:commandButton value="Fechar">
                            <f:ajax render="panelorcamento"
                            event="click"
                            listener="#{demandasMB.hideOrcamento()}"
                            />
                    </h:commandButton>

My problem is, when I click in button "Fechar" my method is calling but my modal don´t close.

Anybody have idea what I´m doing worng ?

thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user812612
  • 379
  • 4
  • 7
  • 15

1 Answers1

0

This is a bug, due to the domElementAttachment the panel is not the place the render is pointing to. You can solve it by rendering the whole form.

That said, you're controlling the panel rather unusually, all you need to do to close the panel is:

<h:commandButton value="Fechar" 
    onclick="#{rich:component('panelorcamento')}.hide()">

and you can open it the same way, using show(), no need to control the show attribute.

Finally showWhenRendered is not used in RF 4.

Makhiel
  • 3,874
  • 1
  • 15
  • 21