Miguel Garz
Miguel Garz

Reputation: 11

Why a4j:output doesn't re-render parent panels

I'm facing the following error: I have a selectOneRadio in one file that uses the a4:support to call something in the serverside. The problem is that I need to reRender a tab component that is in the outmost files in a series of includes. The reRender apparently doesn´t work in this case. here are the codes: My MBean:

public String mudarForcaTrabalho(){
 InstrutorBaseVO instrutor = getDados();
 setDados(ManterInstrutorHelper.transformarInstrutor(instrutor));
 setInterno(!isInterno());
 return null;
}

My outermost file : manter.xhtml

<h:panelGroup id="pnMaster">
-<h:outputText id="txForca2" value="#{instrutorMB.dados.forcaDeTrabalho}"  />-
<rich:tabPanel switchType="client" id="painelTabs">
       <rich:tab id="tabBasicas" label="#{msg.INFO_BASICAS}">
  <div style="padding:5px;"><ui:include src="informacoesBase.xhtml"/></div>
       </rich:tab>
       <rich:tab id="tabLocal" label="#{msg.INFO_LOCALIZACAO}" rendered="#{instrutorMB.dados.forcaDeTrabalho == 'N'}">
        <div style="padding:5px;"><ui:include src="informacoesLocalizacao.xhtml"/></div>
    </rich:tab>
       <rich:tab id="tabDetalhe" label="#{msg.INFO_DETALHADAS}">
           <div style="padding:5px;"><ui:include src="informacoesDetalhadas.xhtml"/></div>
       </rich:tab>
</rich:tabPanel>
</h:panelGroup>

My inner file : informacoesBase.xhtml

 <h:panelGroup id="painelPai">
 <fieldset>

  <h:panelGroup id="pnTeste">
  -<h:outputText id="txForca" value="#{instrutorMB.dados.forcaDeTrabalho}"  />-
  </h:panelGroup> 
  <legend>#{msg.MSG_PERTENCE_FORCA}*</legend>

   <h:selectOneRadio id="rdForcaTrabalho" value="#{instrutorMB.dados.forcaDeTrabalho}" disabled="#{instrutorMB.visualizar}">
   <f:selectItem itemValue="S" itemLabel="#{msg.SIM}"/>
   <f:selectItem itemValue="N" itemLabel="#{msg.NAO}"/>
   <a4j:support ajaxSingle="true" event="onchange" immediate="true" reRender="pnMaster" action="#{instrutorMB.mudarForcaTrabalho}"/>
   </h:selectOneRadio>

 </fieldset>

 </h:panelGroup>

Any help is appreciated. Thank you.

Upvotes: 1

Views: 1968

Answers (3)

Mehrez Marouani
Mehrez Marouani

Reputation: 97

The onchange event is only applicable for the following controls: fileUpload, select, text, textarea. So it doesn't match with the radio button and you have to use "onselect" as the following:

<a4j:support ajaxSingle="true" event="onselect" immediate="true" reRender="pnMaster" action="#{instrutorMB.mudarForcaTrabalho}"/>

Upvotes: 1

Max Katz
Max Katz

Reputation: 1582

ReRender works for components under the same form.

When using reRender the components don't need to be in the same form. They can be anywhere. Try pointing reRender by adding formId:

reRender=":formId:componentId"

Upvotes: 1

Dejell
Dejell

Reputation: 14317

I guess that your files are not under the same h:form or aj4:form

ReRender works for components under the same form.

Upvotes: 2

Related Questions