JSF - commandButton x onclick

5 respostas
I

Pessoal, tenho um dataTable e um commandButton dentro de um simpleTogglePanel

Preciso que quando o commandButton seja clicado o simpleTogglePanel fique "invisivel".

Fiz dessa forma e não esta acontecendo nada:

<a4j:commandButton value="Close"   
            styleClass="contextFormPlainButton"  
            onclick="#{rich:component('divDetails')}.hide()"  
            reRender="divDetails"/>

Código completo:

<div id="divDetails" class="scrollDivExternalSynchronize" >
			<rich:simpleTogglePanel 			
				switchType="ajax" 				
				styleClass="sie-simpleTooglePanel"
				opened="true"
				id="variablePanel"
				label="Execution Detail"
				rendered="#{not empty synchManager.listDetails}"
				height="500px">
				
				<f:facet name="openMarker">
					<h:graphicImage value="../../../images/default/Buttom_mais.png" />
				</f:facet> 
				
				<f:facet name="closeMarker">
					<h:graphicImage value="../../../images/default/Buttom_menos.png" />
				</f:facet> 		
			
				<rich:dataTable  value="#{synchManager.listDetails}"
					var="_synchDetails" id="synchDetails" 						
					rowKeyVar="rowCount" 
					rowClasses="tableRowEven2 , tableRowOdd2" 						
					styleClass="dr-table-subheader2"
					rendered="#{not empty synchManager.listDetails}">
					
					<f:facet name="header">
                        <h:outputText value="#{synchManager.syncDateTime} - Execution: #{synchManager.execution}"></h:outputText>
                    </f:facet> 
					
					<rich:column sortable="false">
						<f:facet name="header">
							<h:outputText value="#{labels.packageName}" />
						</f:facet>
						<h:outputText value="#{_synchDetails.source}" ></h:outputText>
					</rich:column>	
					
					<rich:column sortable="false">
						<f:facet name="header">
							<h:outputText value="#{labels.stepExecutionStatus}" />
						</f:facet>
						<h:outputText value="#{_synchDetails.message}" ></h:outputText>
					</rich:column>							
				</rich:dataTable>	
				
								
					<a4j:commandButton value="Close" 
										styleClass="contextFormPlainButton"
										onclick="#{rich:component('divDetails')}.hide()"
							   			reRender="divDetails"/>
			
						
				</rich:simpleTogglePanel> 
					
			</div>

Desde já agradeço!

5 Respostas

R

Olá.
tenta usar o hide() num componente do RichFaces(um outputPanel,por exemplo)

I

raf4ever:
Olá.
tenta usar o hide() num componente do RichFaces(um outputPanel,por exemplo)

Olá raf4ever!

coloquei toda a DIV dentro de um <a4j:outputPanel id=“modalDetails” > e mesmo assim não funciona.

&lt;a4j:outputPanel id="modalDetails" &gt;
			
			&lt;div id="divDetails" class="scrollDivExternalSynchronize" &gt;
			&lt;rich:simpleTogglePanel 			
				switchType="ajax" 				
				styleClass="sie-simpleTooglePanel"
				opened="true"
				id="variablePanel"
				label="Execution Detail"
				rendered="#{not empty synchManager.listDetails}"
				height="500px"&gt;
				
				&lt;f:facet name="openMarker"&gt;
					&lt;h:graphicImage value="../../../images/default/Buttom_mais.png" /&gt;
				&lt;/f:facet&gt; 
				
				&lt;f:facet name="closeMarker"&gt;
					&lt;h:graphicImage value="../../../images/default/Buttom_menos.png" /&gt;
				&lt;/f:facet&gt; 		
			
				&lt;rich:dataTable  value="#{synchManager.listDetails}"
					var="_synchDetails" id="synchDetails" 						
					rowKeyVar="rowCount" 
					rowClasses="tableRowEven2 , tableRowOdd2" 						
					styleClass="dr-table-subheader2"
					rendered="#{not empty synchManager.listDetails}"&gt;
					
					&lt;f:facet name="header"&gt;
                        &lt;h:outputText value="#{synchManager.syncDateTime} - Execution: #{synchManager.execution}"&gt;&lt;/h:outputText&gt;
                    &lt;/f:facet&gt; 
					
					&lt;rich:column sortable="false"&gt;
						&lt;f:facet name="header"&gt;
							&lt;h:outputText value="#{labels.packageName}" /&gt;
						&lt;/f:facet&gt;
						&lt;h:outputText value="#{_synchDetails.source}" &gt;&lt;/h:outputText&gt;
					&lt;/rich:column&gt;	
					
					&lt;rich:column sortable="false"&gt;
						&lt;f:facet name="header"&gt;
							&lt;h:outputText value="#{labels.stepExecutionStatus}" /&gt;
						&lt;/f:facet&gt;
						&lt;h:outputText value="#{_synchDetails.message}" &gt;&lt;/h:outputText&gt;
					&lt;/rich:column&gt;							
				&lt;/rich:dataTable&gt;					
						
				&lt;a4j:commandButton value="Close" styleClass="contextFormPlainButton" onclick="#{rich:component('modalDetails')}.hide()"/&gt;
									
				&lt;/rich:simpleTogglePanel&gt; 
					
				&lt;/div&gt;
				&lt;/a4j:outputPanel&gt;
R

Olá.

Na verdade o q eu quis dizer foi isso:

onclick="#{rich:component('modalDetails')}.hide()"
I

raf4ever:
Olá.

Na verdade o q eu quis dizer foi isso:

onclick="#{rich:component('modalDetails')}.hide()"

Foi o que eu fiz (linha 47). :slight_smile:

R

[EDITADO]
Isso tá dentro de um form?

Criado 19 de janeiro de 2011
Ultima resposta 19 de jan. de 2011
Respostas 5
Participantes 2