Checkbox não seleciona tudo. Como resolver?

16 respostas
T

Pessoal,
Meu checkbox não está selecionando todas as caixas. Alguém pode ajudar ?

Estou usando esta função:

<head>	
    	<script language="javascript" type="text/javascript" src="${ctx}/js/jquery-1.10.2.js"></script>	
    	<script>
    	$(document).ready(function() {
    		$('#checkBoxAll').click(function() {
    			if ($(this).is(":checked"))
    				$('.chkCheckBoxId').prop('checked', true);
    			else
    				$('.chkCheckBoxId').prop('checked', false);
    		});
    	});
    </script>
    </head>

aqui exibe meu checkbox em varias linhas de acordo com as informações do banco, ou seja, se eu marcar o checkBox (checkBoxAll), então todas os checkbox devem ser selecionados.
Isso não está acontecendo, alguém pode ajudar?

<rich:column>
        <f:facet name="header">
		<input type="checkbox" id="checkBoxAll" />
		</f:facet>
		<input type="checkbox" class="chkCheckBoxId"
		value="#{empregados.codigo}" name="paramCodigoEmpregado" />
                    </rich:column>
		            <rich:column>
                    	<h:outputText value="#{empregados.matricula} - #{empregados.nome}" />
                    </rich:column>

16 Respostas

D

Fiz um teste aqui e o seu script funcionou

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    	jQuery(document).ready(function() {
    		jQuery('#checkBoxAll').click(function() {
    			if (jQuery(this).is(":checked"))
    				jQuery('.chkCheckBoxId').prop('checked', true);
    			else
    				jQuery('.chkCheckBoxId').prop('checked', false);
    		});
    	});
</script>
</head>
<body>

<input type="checkbox" id="checkBoxAll">
<br />
<input type="checkbox" class="chkCheckBoxId">
<input type="checkbox" class="chkCheckBoxId">
<input type="checkbox" class="chkCheckBoxId">
<input type="checkbox" class="chkCheckBoxId">
</body>
</html>
  • Tente trocar o símbolo $ por jQuery, pode ser que alguma biblioteca esteja sobrescrevendo a variável $;
  • Verifique o console do browser se há erros;
  • Talvez o caminho src="${ctx}/js/jquery-1.10.2.js" não esteja correto, mude para src="https://code.jquery.com/jquery-3.1.1.min.js"
T

diego12, obrigado pelo retorno!

Segui suas instruções mas não consegui fazer funcionar o checkBoxAll.
Quando seleciono o checkbox ele não marca os outros, tipo no e-mail.
Onde posso estar errando ?

D

Verifique o id e o class dos checkbox no navegador ou então tente usar o class em vez do id.

T

diego12, verifiquei como informado mas não consegui achar o possível problema de não estar funcionando o checkbox. Se você puder me ajudar,eu agradeço.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
	
	<head>	
	<script language="javascript" type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>	
	<script>
	jQuery(document).ready(function() {
		jQuery('#checkBoxAll').click(function() {
			if (jQuery(this).is(":checked"))
				jQuery('.chkCheckBoxId').prop('checked', true);
			else
				jQuery('.chkCheckBoxId').prop('checked', false);
		});
	});
	</script>
</head>
	
	<ui:composition template="/templates/templateAdmin.xhtml">	
		
		<ui:define name="tabela">
		
			<a4j:outputPanel id="panelLista" ajaxRendered="true">
				
				<rich:dataTable id="dataresultados" value="#{controleEvento.modelEmpregados}" var="empregados"                                    
                	border="0" cellpadding="1" cellspacing="1" align="center" width="100%"
                	rowClasses="tabelaCinza_Row1,tabelaCinza_Row2"             	
                >
                
                	<f:facet name="header">
		           		<rich:columnGroup>
		           			<rich:column colspan="8" style="text-align:center;">
							     
							     <a4j:commandLink id="btnRefresh" value="Recarregar" style="width:120px;"
				            			actionListener="#{controleEvento.actionFindAllByCodigoEvento}"
				                       	action="#{controleEvento.actionIrEmpregadosInscritosEvento}"
				                     >
          								<f:param name="paramCodigoEvento" value="#{controleEvento.eventoTO.codigo}" />					            		
					            	</a4j:commandLink>			            	
	                    	</rich:column>
		           			
		           			<rich:column breakBefore="true" width="1%">
		                        <h:outputText value=" &nbsp; "/>
		                    </rich:column>
							<rich:column width="25%">
		                   		<h:outputText value="Nome" />
		                   	</rich:column>
		                   	<rich:column width="15%">
		                   		<h:outputText value="Lotação" />
		                   	</rich:column>                	
		                 	<rich:column width="20%">
		                   		<h:outputText value="E-mail" />
		                   	</rich:column>
		                   	<rich:column width="8%">
		                   		<h:outputText value="Telefone" />
		                   	</rich:column>
		                   	<rich:column width="20%">
		                   		<h:outputText value="Anexo" />
		                   	</rich:column>
		                 	<rich:column width="10%">
		                   		<h:outputText value="Data Inscrição" />
		                   	</rich:column>
		                   	<rich:column width="2%">
		                         <a4j:commandLink id="btnExcluir"
					            	action="#{controleEvento.actionOutComeEvento}"
				                    actionListener="#{controleEvento.actionDesassociarEmpregadoEvento}"
					                onclick="if(!excluir()){return;}"
							    	reRender="msg,panelLista,dataresultados"
					                >
						            
						            <h:graphicImage value="/imagens/icone/ico_excluir.gif" alt="Excluir" styleClass="noBorder"/>
						            
						            <f:param name="paramCodigoEvento" value="#{controleEvento.eventoTO.codigo}" />
						            <f:param name="paramCodigoEmpregado" value="#{empregados.codigo}" />
				            		            		
				        		</a4j:commandLink>
		                    </rich:column>
                 	
                 		</rich:columnGroup>
		            </f:facet>
		            
		            <rich:column>
                    	
                    </rich:column>
		            <rich:column>
                    	<h:outputText type="checkbox" class="chkCheckBoxId" value="#{empregados.matricula} - #{empregados.nome}" />
                    </rich:column>
                    
                    <rich:column>
                    	<h:outputText type="checkbox" class="chkCheckBoxId" value="#{empregados.siglaLotacao} - #{empregados.unidade}" />
                    </rich:column>
                    
                    <rich:column>
                    	<h:outputText type="checkbox" class="chkCheckBoxId" value="#{empregados.email}" />
                    </rich:column>
                    
                    <rich:column style="text-align:center;">
                    	<h:outputText type="checkbox" class="chkCheckBoxId" value="#{empregados.telefone}" />
                    </rich:column>
                    
                    <rich:column>
                    	<rich:dataList value="#{empregados.listaAnexos}" var="listaAnexos">
				    		<a4j:commandLink style="font-weight:bold;" type="checkbox" value="#{listaAnexos.formularioAnexo}"
       										onclick="abrirArquivoDocumento('#{ctx}','#{listaAnexos.formularioAnexo}', 2)" />											    													    	
				    	</rich:dataList>
                    </rich:column>
                    
                    <rich:column style="text-align:center;">
                    	<h:outputText type="checkbox" class="chkCheckBoxId" value="#{empregados.dataCadastro}" >
                    		<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="America/Sao_Paulo" />
                    	</h:outputText>
                    </rich:column>
                    
                    <rich:column>
                    	<f:facet name="header">
					 		<input type="checkbox" id="checkBoxAll" />
						</f:facet>
						<input type="checkbox" class="chkCheckBoxId"
							value="#{empregados.codigo}" name="paramCodigoEmpregado" />
                    </rich:column>
                                     	
                </rich:dataTable>
				
			</a4j:outputPanel>
		
		</ui:define>
	
	</ui:composition>

</html>
D

Eu teria que ver como a página está sendo construída. No navegador, clique com botão direito do mouse e depois"ver código-fonte da página", deve abrir uma nova aba, poste o código aqui. Não esqueça de apagar informações pessoais antes de postar*.

T

diego12, obrigado novamente pelo retorno!

segue o código da página.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
	
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
  		<link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css" /><link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/meusistema/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/browser_info.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css" /><script src="/meusistema/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msg.css.jsf" rel="stylesheet" type="text/css" /><link class="component" href="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msgs.css.jsf" rel="stylesheet" type="text/css" /><link class="component" href="/meusistema/a4j/s/3_3_3.FinalMETA-INF/skins/laguna.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css" /><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.jsf" type="text/javascript"></script><link rel="shortcut icon" href="http://www.empresa.com.br/favicon.ico" type="image/xicon" />
  		
  		<link rel="stylesheet" type="text/css" href="/meusistema/css/common.css" />
  		<script language="javascript" type="text/javascript" src="/meusistema/js/controles.js"></script>
  		
        <title>meusistema -</title>
        
        <link rel="stylesheet" type="text/css" href="/meusistema/css/common.css" />        
        
	</head>
	
	<body><div id="statusPanel" style="display: none;"><input autocomplete="off" id="statusPanelOpenedState" name="statusPanelOpenedState" type="hidden" /><div class="rich-modalpanel " id="statusPanelContainer" style="position: absolute; display: none; z-index: 100; background-color: inherit;"><div class="rich-mpnl-mask-div-opaque rich-mpnl-mask-div" id="statusPanelDiv" style="z-index: -1;"><button class="rich-mpnl-button" id="statusPanelFirstHref"></button></div><div class="rich-mpnl-panel"><div class="rich-mp-container" id="statusPanelCDiv" style="position: absolute; left: 0px; top: 0px; z-index: 9;"><div class="rich-mpnl-shadow" id="statusPanelShadowDiv"></div><div class="rich-mpnl-ovf-hd rich-mpnl-trim rich-mpnl-content" id="statusPanelContentDiv"><table border="0" cellpadding="0" cellspacing="0" class="rich-mp-content-table" id="statusPanelContentTable" style="height: 100%; width: 100%;"><tr style="height: 99%"><td class="rich-mpnl-body" valign="top">
				<center>
					<img src="/meusistema/imagens/roller.gif" />
					<br />
					<strong>
						Por favor, aguarde. Processando...
					</strong>
				</center></td></tr></table></div><div class="rich-mpnl-resizer" id="statusPanelResizerN" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerE" style="height: 40px; width: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerS" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerW" style="height: 40px; width: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNWU" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNEU" style="height: 40px; width: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNEL" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSEU" style="height: 40px; width: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSEL" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSWL" style="height: 40px; width: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSWU" style="width: 40px; height: 4px;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNWL" style="height: 40px; width: 4px;"></div></div></div><div class="rich-mpnl-mask-div rich-mpnl-mask-div-transparent" id="statusPanelCursorDiv" style="z-index: -200;"><button class="rich-mpnl-button" id="statusPanelLastHref"></button></div><script type="text/javascript">new ModalPanel('statusPanel',
				{
					width: 300,
					height: 70,

					minWidth: 300,
					minHeight: 70,

					resizeable: true,
					moveable: true,

					left: "auto",
					top: "auto",

					zindex: 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide: '',
					domElementAttachment: "",				
					keepVisualState: false,
					showWhenRendered: false,
					selectBehavior: "hide",

					autosized: false,
					overlapEmbedObjects: false});</script></div><script type="text/javascript"></script></div><span id="_viewRoot:status"><span id="_viewRoot:status.start" style="display: none"></span><script type="text/javascript">
window.document.getElementById('_viewRoot:status.start').onstart=function(){document.getElementById('statusPanel').component.show();;};
</script><span id="_viewRoot:status.stop"></span><script type="text/javascript">
window.document.getElementById('_viewRoot:status.stop').onstop=function(){document.getElementById('statusPanel').component.hide();;};
</script></span><form id="formulario" name="formulario" method="post" onkeypress="efetuarLogin(event)" action="/meusistema/views/common/login.jsf">
		
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
				
	    			<td height="74" align="center" valign="top">
	    			
	    				<div id="mainWrapper"> 
	    					
	    					<div class="header"> 
						  		<table width="100%" height="100%" align="center" cellpadding="0" cellspacing="0">
									<tr> 
							  			<td bgcolor="#FFFFFF" align="left" valign="top">
											<img src="/meusistema/imagens/topo.gif" />	
							  			</td>
									</tr>
						  		</table>
							</div>
	    					
	    					<div style="padding:6px;"></div>
	    					
	    					<div class="body" style="height:460px;">
								
								<div class="sessao" align="right">
	    							<font color="#ffffff" size="1">
                                		<span id="contadorSessao"></span>
                            		</font>
	    						</div><img alt="" class="rich-spacer " height="150" id="formulario:j_id7" src="/meusistema/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="1" />
							
								<table width="45%" align="center" cellpadding="1" cellspacing="1" class="formulario">
									<tr>
									
	              						<td width="100%" height="109" align="center"> 
	                					
	                						<table width="35%" border="0" cellspacing="0" cellpadding="0">
							                  	
							                  	<tr> 
							                    	<td width="38%">Login:</td>
							                    	<td width="62%"><input id="formulario:login" type="text" name="formulario:login" maxlength="30" size="25" /></td>
							                  	</tr>
	                  							<tr> 
	                    							<td>Senha:</td>
	                    							<td><input id="formulario:senha" type="password" name="formulario:senha" value="" maxlength="30" size="25" /></td>
	                  							</tr>
	                  							<tr>
	                    							<td></td>
	                    							<td align="right">
	                    								<!-- botao Efetuar Login --><a href="#" id="formulario:btnEfetuarLogin" name="formulario:btnEfetuarLogin" onclick="A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:btnEfetuarLogin','parameters':{'formulario:btnEfetuarLogin':'formulario:btnEfetuarLogin'} } );return false;"><img src="/meusistema/imagens/bt_ok_3.gif" style="border:0px;" /></a>
	                    							</td>
	                  							</tr>
	                						</table>
	                						
	                						<br />
						
											<table border="0" cellpadding="0" cellspacing="0" width="98%" align="center">
								    			<tr>
								    				<td><span id="formulario:msg">
						                                	<table cellpadding="0" cellspacing="0" width="100%" height="1px">
																<tr>
																	<td>
																	
																		<!-- mensagens de erro --><dl id="formulario:j_id18" class="rich-messages" style="display: none; "><dt></dt></dl>
																	</td>
																</tr>
															</table></span>
								                        
								                    </td>
								    			</tr>
											</table>
										
										</td>								
									</tr>						
								</table>
								
							</div>
	    					
	    					
	    				</div>
	    			
	    			</td>
				</tr>
			</table><input type="hidden" autocomplete="off" name="formulario" value="formulario" /><input type="hidden" autocomplete="off" name="autoScroll" value="" /><input type="hidden" autocomplete="off" name="formulario:j_idcl" value="" /><input type="hidden" autocomplete="off" name="formulario:_link_hidden_" value="" /><script type="text/javascript">function clear_formulario() {
_clearJSFFormParameters('formulario','',['formulario:j_idcl','formulario:_link_hidden_']);
}
function clearFormHiddenParams_formulario(){clear_formulario();}
function clearFormHiddenParams_formulario(){clear_formulario();}
clear_formulario();</script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAALVZX2wcRxkfn8/xv9A4cXFqVEeundZ24uzd+fznHLdq7NiOD85J8DmhdVQu47u5u7X3dpfdWd86UUoaqa1ERSlqUxUpiIgWykP7Uh748wSqBFKlFjUSAiGBKoSEkKBIqFKBB2Bm9nZ3dm/vfLHDPaxnZ+f7vvl+398Zv/U30KJr4JiiFQS4Ac3xDT0vQFWVxCzEoiILqxpCaawZWWxo6KySQze+8ffX3s0Ptu0HwFSvAND8Ihj0UGeVkqrISMbCLJm6KKLyiqJg0J7ZsofWL+yT6tIVcUlixCkF5uYMOSch0LKREXNjwP4dp6SamC3mYRbpftol8lhWclA6D2UkgU4dQ2zo1ov1awIjG3ALmkJNerb6jKYYqiV73JFdd9uUlG49zUSCfZZoh/boTiovKloJdOTJ05CgJioVulYwtKPGaZV80azdTjkSd9LznIFVA68iE1uU014960pMyg6ppBREeTdC91GhMdeyo41JTaOshohcHclF6BBHGjHNaaVUgnIuJcqb4MA6lhfyCBtQS3EaNIHjO2hwRoNqUcwmS7CAKjpM3N02LAwsp2wu6QVH9IkdEVghH5eRrhPZekV4wpZtGhrovpSi2xckKBeEc+sbKItnXvrgie906SNSiMYtWRcyvgKeBiHPqNkZtTmjdlXlg5dOt5GMcdAVMKcoEoLy+/3a9V/f+vfHIdC0Blq2oGQgU23SKUE7UCmXjqXV5VRmbjadPI1Bb4Sy1CNEvZIiR5j/CCZVkXDvYtwNLEpCSslCCT39z4OXb0X/9dcQCCdBWxHqxSzJRSnQmlUMGWvbGBxiKkfojiIkYYlyYSYF2uirQWCiuzhAlm+RmIIy0+KAqf6X/DAIza2Qh4pJYvIqlpQxKiDt0B9vv/HpM88niGJJWzF7i2zdWaO0jrTn3rrZ1/nKRy/YAPeoKmHX7Woyq2lwOyXq2HzmTt+3fgm/3UwZhnXxCmIETeUwfRKiR4Kdj+YUtKRIOaSl4RbSn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>
		
	</body>

</html>
D

Esse código me parece ser de outra página, não encontrei a tabela, o script e os checkbox.

Se estiver usando o Chrome ou Firefox, clique com botão direito sobre o checkbox (de selecionar tudo) e depois “inspecionar elemento” como na imagem

Observe que eu fiz para o campo de login, me apontando para um input com id="formulario:login", mas no eclipse vc deve ter colocado id="login", caso esteja diferente, vc terá que mudar o script para o id que é apresentado no navegador.

Depois verifique se o script está lá, mova até a tag head e tente encontrar o script

Nesta imagem eu inseri o script pois no código postado não existe e deveria estar lá.

T

diego12, boa tarde!

Fiz como você informou. Percebi que a página do checkbox está puxando o head de outra página, como no código abaixo que tirei como você informou. Será esse o motivo do script do checkbox não aparecer no código abaixo?

O head que aparece pertence a página “**<ui:composition template="/templates/templateAdmin.xhtml">**”, como mostra o código anterior que te enviei, não o errado, o anterior a ele.

Tenho que inserir o script do checkbox na outra página também ou estou errado? Segue abaixo o código do “Inspecionar”.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
  		<link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" media="rich-extended-skinning" rel="stylesheet" type="text/css"><script src="/meusistema/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/browser_info.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><script src="/meusistema/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/s/3_3_3.Finalcss/toolBar.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><script src="/meusistema/a4j/g/3_3_3.Finalscripts/menu.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/s/3_3_3.Finalcss/dropdownmenu.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/form.js.jsf" type="text/javascript"></script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/menu.js.jsf" type="text/javascript"></script><link class="component" href="/meusistema/a4j/s/3_3_3.Finalcss/menucomponents.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><link class="component" href="/meusistema/a4j/s/3_3_3.Finalcss/table.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><link class="component" href="/meusistema/a4j/s/3_3_3.FinalMETA-INF/skins/laguna.xcss/DATB/eAFb-IhhU-jyGdIAE0wD5Q__.jsf" rel="stylesheet" type="text/css"><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/meusistema/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.jsf" type="text/javascript"></script><link rel="shortcut icon" href="http://www.xxx.com.br/favicon.ico" type="image/xicon">
  		
  		<link rel="stylesheet" type="text/css" href="/meusistema/css/common.css">
  		<script language="javascript" type="text/javascript" src="/meusistema/js/controles.js"></script>
  		
        <title>meusistema - Sistema de Palestras e Eventos</title>
        
        <link rel="stylesheet" type="text/css" href="/meusistema/css/common.css">        
        
	</head>
	
	<body><div id="statusPanel" style="display: none;"><input autocomplete="off" id="statusPanelOpenedState" name="statusPanelOpenedState" type="hidden"><div class="rich-modalpanel " id="statusPanelContainer" style="position: absolute; display: none; z-index: 100; background-color: inherit;"><div class="rich-mpnl-mask-div-opaque rich-mpnl-mask-div" id="statusPanelDiv" style="z-index: -1;"><button class="rich-mpnl-button" id="statusPanelFirstHref"></button></div><div class="rich-mpnl-panel"><div class="rich-mp-container" id="statusPanelCDiv" style="position: absolute; left: 0px; top: 0px; z-index: 9;"><div class="rich-mpnl-shadow" id="statusPanelShadowDiv"></div><div class="rich-mpnl-ovf-hd rich-mpnl-trim rich-mpnl-content" id="statusPanelContentDiv"><table border="0" cellpadding="0" cellspacing="0" class="rich-mp-content-table" id="statusPanelContentTable" style="height: 100%; width: 100%;"><tbody><tr style="height: 99%"><td class="rich-mpnl-body" valign="top">
				<center>
					<img src="/meusistema/imagens/roller.gif">
					<br>
					<strong>
						Por favor, aguarde. Processando...
					</strong>
				</center></td></tr></tbody></table></div><div class="rich-mpnl-resizer" id="statusPanelResizerN" style="width: 40px; height: 4px; cursor: n-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerE" style="height: 40px; width: 4px; cursor: e-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerS" style="width: 40px; height: 4px; cursor: s-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerW" style="height: 40px; width: 4px; cursor: w-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNWU" style="width: 40px; height: 4px; cursor: nw-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNEU" style="height: 40px; width: 4px; cursor: ne-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNEL" style="width: 40px; height: 4px; cursor: ne-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSEU" style="height: 40px; width: 4px; cursor: se-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSEL" style="width: 40px; height: 4px; cursor: se-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSWL" style="height: 40px; width: 4px; cursor: sw-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerSWU" style="width: 40px; height: 4px; cursor: sw-resize;"></div><div class="rich-mpnl-resizer" id="statusPanelResizerNWL" style="height: 40px; width: 4px; cursor: nw-resize;"></div></div></div><div class="rich-mpnl-mask-div rich-mpnl-mask-div-transparent" id="statusPanelCursorDiv" style="z-index: -200;"><button class="rich-mpnl-button" id="statusPanelLastHref"></button></div><script type="text/javascript">new ModalPanel('statusPanel',
				{
					width: 300,
					height: 70,

					minWidth: 300,
					minHeight: 70,

					resizeable: true,
					moveable: true,

					left: "auto",
					top: "auto",

					zindex: 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide: '',
					domElementAttachment: "",				
					keepVisualState: false,
					showWhenRendered: false,
					selectBehavior: "hide",

					autosized: false,
					overlapEmbedObjects: false});</script></div><script type="text/javascript"></script></div><span id="_viewRoot:status"><span id="_viewRoot:status.start" style="display: none"></span><script type="text/javascript">
window.document.getElementById('_viewRoot:status.start').onstart=function(){document.getElementById('statusPanel').component.show();;};
</script><span id="_viewRoot:status.stop"></span><script type="text/javascript">
window.document.getElementById('_viewRoot:status.stop').onstop=function(){document.getElementById('statusPanel').component.hide();;};
</script></span><form id="formulario" name="formulario" method="post" action="/meusistema/views/admin/adminEmpregadosInscritosEvento.jsf" target="">
		
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tbody><tr>
				
	    			<td height="74" valign="top">
	    			
	    				<div id="mainWrapper"> 
	    					
	    					<div class="header"> 
						  		<table width="100%" height="100%" align="center" cellpadding="0" cellspacing="0">
									<tbody><tr> 
							  			<td bgcolor="#FFFFFF" align="left" valign="top">
											<img src="/meusistema/imagens/topo.gif">	
							  			</td>
									</tr>
						  		</tbody></table>
							</div>
	    					
	    					<div><table border="0" cellpadding="0" cellspacing="0" class="rich-toolbar " height="10" id="formulario:j_id7" width="100%"><tbody><tr valign="middle"><td class="rich-toolbar-item "><div class="rich-ddmenu-label rich-ddmenu-label-unselect  " id="formulario:j_id8"><div class="rich-label-text-decor">Cadastrar</div><div style="margin: 0px; padding: 0px; border: 0px; position: absolute; z-index: 100;"><div id="formulario:j_id8_menu" class="rich-menu-list-border" style="display: none; z-index: 2;"><div class="rich-menu-list-bg"><div class="rich-menu-item rich-menu-item-enabled" id="formulario:j_id11" onclick="RichFaces.Menu.updateItem(event,this);A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:j_id11','parameters':{'formulario:j_id11':'formulario:j_id11'} } )"><span class="rich-menu-item-icon  " id="formulario:j_id11:icon"><img alt="" height="16" src="/meusistema/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="16"></span><span class="rich-menu-item-label" id="formulario:j_id11:anchor">Empregado</span></div><div class="rich-menu-separator" id="formulario:j_id12"></div><div class="rich-menu-item rich-menu-item-enabled" id="formulario:j_id13" onclick="RichFaces.Menu.updateItem(event,this);A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:j_id13','parameters':{'formulario:j_id13':'formulario:j_id13'} } )"><span class="rich-menu-item-icon  " id="formulario:j_id13:icon"><img alt="" height="16" src="/meusistema/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="16"></span><span class="rich-menu-item-label" id="formulario:j_id13:anchor">Evento</span></div><div class="rich-menu-list-strut"><div class="rich-menu-list-strut" style="">&nbsp;</div></div></div></div><script id="formulario:j_id8_menu_script" type="text/javascript">new RichFaces.Menu.Layer('formulario:j_id8_menu',{'hideDelay':800,'delay':50} ).asDropDown('formulario:j_id8').addItems([['formulario:j_id11'] ,['formulario:j_id13'] ] );</script></div></div></td><td align="center"><img src="/meusistema/a4j/g/3_3_3.Finalorg.richfaces.renderkit.html.images.SquareSeparatorImage/DATB/eAH7cW3f!--fGICAm4EDADk1BYg_.jsf" alt=""></td><td class="rich-toolbar-item "><div class="rich-ddmenu-label rich-ddmenu-label-unselect  " id="formulario:j_id14"><div class="rich-label-text-decor">Sair</div><div style="margin: 0px; padding: 0px; border: 0px; position: absolute; z-index: 100;"><div id="formulario:j_id14_menu" class="rich-menu-list-border" style="display: none; z-index: 2;"><div class="rich-menu-list-bg"><div class="rich-menu-item rich-menu-item-enabled" id="formulario:j_id17" onclick="RichFaces.Menu.updateItem(event,this);A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:j_id17','parameters':{'formulario:j_id17':'formulario:j_id17'} } )"><span class="rich-menu-item-icon  " id="formulario:j_id17:icon"><img alt="" height="16" src="/meusistema/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="16"></span><span class="rich-menu-item-label" id="formulario:j_id17:anchor">Deslogar</span></div><div class="rich-menu-list-strut"><div class="rich-menu-list-strut" style="">&nbsp;</div></div></div></div><script id="formulario:j_id14_menu_script" type="text/javascript">new RichFaces.Menu.Layer('formulario:j_id14_menu',{'hideDelay':800,'delay':50} ).asDropDown('formulario:j_id14').addItems([['formulario:j_id17'] ] );</script></div></div></td><td style="width:100%"></td></tr></tbody></table>
	    					</div>
	    					
	    					<div class="sessao" align="right">
	    						<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
								  <tbody><tr> 
								    <td width="50%" height="5px">
								    	<font color="#999999" size="1">
                            			</font>
								    </td>
								    <td width="50%" height="5px" align="right">
								    	
								    </td>
								  </tr>
								</tbody></table>
	    					</div>
	    					
	    					<div class="body">
								
								<!-- Formulário da Tela-->
								<table align="center" border="0" cellpadding="0" cellspacing="0" width="99%">
							    	<tbody><tr> 
										<td width="14"><img name="topo_janela_esq" src="/meusistema/imagens/topo_janela_esq.gif" width="14" height="14" border="0"></td>
									   	<td width="100%" height="4" background="/meusistema/imagens/topo_janela_meio.gif"></td>
									   	<td width="14"><img name="topo_janela_dir" src="/meusistema/imagens/topo_janela_dir.gif" width="14" height="14" border="0"></td>
									</tr>
									<tr> 
									  	<td height="40" background="/meusistema/imagens/meio_janela_esq.gif"></td>
									    <td height="390" valign="top">
							      	
							      			<!-- BEGIN FORMULARIO -->
							      			<!-- END FORMULARIO -->
							      			
							      			<br><span id="formulario:panelLista"><table class="rich-table " id="formulario:dataresultados" align="center" border="0" cellpadding="1" cellspacing="1" width="100%"><colgroup span="8"></colgroup><thead class="rich-table-thead"><tr class="rich-table-header  "><th class="rich-table-headercell " id="formulario:dataresultados:j_id23" colspan="8" style="text-align:center;"><a href="#" id="formulario:dataresultados:btnRefresh" name="formulario:dataresultados:btnRefresh" onclick="A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:dataresultados:btnRefresh','parameters':{'paramCodigoEvento':279,'formulario:dataresultados:btnRefresh':'formulario:dataresultados:btnRefresh'} } );return false;" style="width:120px;">Recarregar</a></th></tr><tr class="rich-table-header-continue  "><th class="rich-table-headercell " id="formulario:dataresultados:j_id25" width="1%">  </th><th class="rich-table-headercell " id="formulario:dataresultados:j_id27" width="25%">Nome</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id29" width="15%">Lotação</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id31" width="20%">E-mail</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id33" width="8%">Telefone</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id35" width="20%">Anexo</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id37" width="10%">Data Inscrição</th><th class="rich-table-headercell " id="formulario:dataresultados:j_id39" width="2%"><a href="#" id="formulario:dataresultados:btnExcluir" name="formulario:dataresultados:btnExcluir" onclick="if(!excluir()){return;};A4J.AJAX.Submit('formulario',event,{'similarityGroupingId':'formulario:dataresultados:btnExcluir','parameters':{'paramCodigoEvento':279,'formulario:dataresultados:btnExcluir':'formulario:dataresultados:btnExcluir','paramCodigoEmpregado':''} } );return false;"><img src="/meusistema/imagens/icone/ico_excluir.gif" alt="Excluir" class="noBorder"></a></th></tr><tr class="rich-table-subheader "><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id43header"><div id="formulario:dataresultados:j_id43header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id45header"><div id="formulario:dataresultados:j_id45header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id47header"><div id="formulario:dataresultados:j_id47header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id49header"><div id="formulario:dataresultados:j_id49header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id51header"><div id="formulario:dataresultados:j_id51header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id53header"><div id="formulario:dataresultados:j_id53header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id56header"><div id="formulario:dataresultados:j_id56header:sortDiv"></div></th><th class="rich-table-subheadercell  " scope="col" id="formulario:dataresultados:j_id58header"><div id="formulario:dataresultados:j_id58header:sortDiv">
					 		<input type="checkbox" id="checkBoxAll"></div></th></tr></thead><tbody id="formulario:dataresultados:tb"><tr class="rich-table-row rich-table-firstrow tabelaCinza_Row1"><td class="rich-table-cell " id="formulario:dataresultados:0:j_id43">
                    	<!--  --></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id45"><span class="chkCheckBoxId">00003 - Fulano</span></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id47"><span class="chkCheckBoxId">PBS</span></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id49"><span class="chkCheckBoxId">fulano@email</span></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id51" style="text-align:center;"><span class="chkCheckBoxId">12345-6347</span></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id53"><ul class="rich-datalist " id="formulario:dataresultados:0:j_id54"></ul></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id56" style="text-align:center;"><span class="chkCheckBoxId">19/04/2016 14:16</span></td><td class="rich-table-cell " id="formulario:dataresultados:0:j_id58">
						<input type="checkbox" class="chkCheckBoxId" value="1463" name="paramCodigoEmpregado"></td></tr><tr class="rich-table-row tabelaCinza_Row2"><td class="rich-table-cell " id="formulario:dataresultados:1:j_id43">
                    	<!--  --></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id45"><span class="chkCheckBoxId">0002 - ciclano</span></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id47"><span class="chkCheckBoxId">PPA - Novo</span></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id49"><span class="chkCheckBoxId">ciclano@email</span></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id51" style="text-align:center;"><span class="chkCheckBoxId">12345-7894</span></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id53"><ul class="rich-datalist " id="formulario:dataresultados:1:j_id54"></ul></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id56" style="text-align:center;"><span class="chkCheckBoxId">03/05/2016 12:03</span></td><td class="rich-table-cell " id="formulario:dataresultados:1:j_id58">
						<input type="checkbox" class="chkCheckBoxId" value="1496" name="paramCodigoEmpregado"></td></tr></tbody></table></span>
							      						
							      		</td>
							      		<td background="/meusistema/imagens/meio_janela_dir.gif"></td>
							    	</tr>
							    
									<tr> 
										<td><img name="down_janela_esq" src="/meusistema/imagens/down_janela_esq.gif" width="14" height="14" border="0"></td>
										<td width="100%" height="5" background="/meusistema/imagens/down_janela_meio.gif"></td>
										<td><img name="down_janela_dir" src="/meusistema/imagens/down_janela_dir.gif" width="14" height="14" border="0"></td>
									</tr>
								</tbody></table>
								
								<br>
								
							</div>
	    					
	    				</div>
	    			
	    			</td>
				</tr>
			</tbody></table><input type="hidden" autocomplete="off" name="formulario" value="formulario"><input type="hidden" autocomplete="off" name="autoScroll" value=""><script type="text/javascript">function clear_formulario() {
_clearJSFFormParameters('formulario','',['formulario:j_idcl','formulario:_link_hidden_']);
}
function clearFormHiddenParams_formulario(){clear_formulario();}
function clearFormHiddenParams_formulario(){clear_formulario();}
clear_formulario();</script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAAOU8aXAc1ZlPI9mW5EOHhQ9AtizJSIbxaGZ6ZjSyTGJZku0BybIl2WC7QG7N9Eht93SPe3qksY1Z4yqggLXDEsy1dkECCclCfsRUMAvFkfVuoFIbrmxCDjYxKXaBZeNsKDb2HqB93+vpa9Q9arVkObBdpVF//a7vet/73ve+7qd/j2alRHS1IA556D10JrAnFffQySTHRmmJFXhPv8gwfZKYjkppkdksxJgjX/vDQ2fidcXzEMokDyBUhFCdoXVUSCQFnuElTxt+tJ1lRnsFQUIlAyPKrXwV5YyqtRuWEhxp3CXQsfVpPsYxaNaeATbmR8p1DTQV2ehwnI4yqdy2m/BPtxCjuS00z3BobkqipXRKBuSrAK3aQ4/QGY9le1J7oyikk/LYAXXsvGhDU0C9jwyJZstDq23rJyJ5gyAmUGkc/6Y5WmSFbLtC1Dghxf2CwK2nRRnd5mxDF1o9YcMOUUh2CKN8N8On5dZhwqJZHD2IOTZZTrXY5nFPWkqmpX4mI6HZ0NLnRdpViFZNLGSMcURiEtnmPrWxx1bTPiZJi7QkiNn2mn5NemhKbTpJfsvNAw4ZLrcOOud4SMfxgsmTDWomGwGZbZMdvkUdvMnOrJLbyxO5NAn/ulg8w1T8r56Y97RE99OD2KIsiOFbkUmlOYmOCSnSfvYwQ8cYEbkn7Kdd4NIJXicEv6I8JajBZutsQ0pF3xYP2oVEguZjXSy/F5UOSnwvE8dUDKudrDCXwbbIFqzrCUZistru1yzaJBF2rm7+kNMxm52PGXY6pnNDRnkdjkn5nI/pdzom5XxMVYdkIzDJgZ0rEuVUkSjnikQ5VSRKUyRHM7wzE+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Bq24/RRis9EXUqfyTczUm2xE9ujFJ+Jsu8zlUNuR428CZuxVdYfsuMCUor/RF1C/8nlzy/f6YlQ+QOhiSNU2Q8vS/qvMBsY4yRCFYJkfNOYSQeTolMpIcrSWvAkX5jqVnSLg31+c9Dtp+yGqfKgZBmrakErLXrrSUvteMNgMzrFoqEpkmdJlhEReC1+SjEoCS1m440rGFlDGletOigyUlrkWw+NC02Rzwct1n3NluX3MjH4fmkfI/2Ce2fn8X++epmLvNuW831TXP58x+3HH3judKCQfEduHuZTeVblC7FhTKSGDK8Kj3sNctxr+QbMTONhZp/SWmTyzMEEDNrx+wPK/iVg+O6F4euV5Dvn48JKmCE0J8lWV0LLmlioxaeaWKwQDPwOZMXlGWLjEpqTnd7JnAu7V7ywXoCXD/MY6SmZZn/sixIibG6Z5hBhQNnWBXTbuukLEU5JLJTfqVgaUZUhtyWvJG5A2xxIIux1h81z9yfBfGUHGfDbZn6VnvnKoDL/k/8HWXnrxkxqAAA="></form>
	    
	

</body></html>
P

Thyengo,

para tirar essa dúvida, abaixo dessa linha

jQuery('#checkBoxAll').click(function() {

coloque algo do tipo:

alert("chegou aqui");

Se aparecer a janela com a mensagem, você vai descobrir que está tudo certo com o click e o seletor do checkbox do head.

T

Pedro_H_Victorino,

coloquei o alerta mas e não apareceu mensagem. Acho que está faltando algo, difícil saber onde estou errando. Talvez seja um pequeno detalhe que eu não estou conseguindo ver.

Se tiver outra sugestão, eu agradeço!

D

Neste caso acho que seria melhor retirar do head e colocar depois de

<ui:composition template="/templates/templateAdmin.xhtml">

ou depois de fechar a tabela

</rich:dataTable>
P

Se não apareceu a mensagem, quer dizer que o seletor não está certo, ele não está conseguindo capturar o click.

Crie um arquivo .js, importe-o em todos os seus arquivos que compõe essa página e coloque seu script.

T

diego12,

Fiz seus dois passos mas não funcionou. Testei um de cada vez.

<ui:composition template="/templates/templateAdmin.xhtml">
		
		<script>
	jQuery(document).ready(function() {
		jQuery('#checkBoxAll').click(function() {
			if (jQuery(this).is(":checked"))
				jQuery('.chkCheckBoxId').prop('checked', true);
			else
				jQuery('.chkCheckBoxId').prop('checked', false);
		});
	});
	</script>

depois fiz abaixo da tabela:

</rich:dataTable>
				
					<script>
						jQuery(document).ready(function() {
							jQuery('#checkBoxAll').click(function() {
								if (jQuery(this).is(":checked"))
									jQuery('.chkCheckBoxId').prop('checked', true);
								else
									jQuery('.chkCheckBoxId').prop('checked', false);
							});
						});
					</script>
				
			</a4j:outputPanel>
		
		</ui:define>
	
	</ui:composition>

</html>
T

Pedro, desculpa minha ignorância, mas o que insiro no .js e como importo ele para as outras páginas ?

P

Fique tranquilo, estou aqui pra ajudar.

Para importar basta fazer dessa forma:

<script type="text/javascript" src="caminho/do/arquivo.js"></script>

E nesse arquivo, vocÊ vai colocar o mesmo script que já estava utilizando anteriormente.

jQuery(document).ready(function() {
jQuery('#checkBoxAll').click(function() {
     if (jQuery(this).is(":checked"))
        jQuery('.chkCheckBoxId').prop('checked', true);
    else
        jQuery('.chkCheckBoxId').prop('checked', false);
    });
});

Lembre-se de importar primeiro o jquery, depois o arquivo desejado.

Exemplo:

<script type="text/javascript" src="jquery.js"></script>	
<script type="text/javascript" src="caminho/do/arquivo.js"></script>
D

Faltou o JQuery, sem o JQuery não vai funcionar.

Vc viu se está carregando o Script no navegador? Dê uma olhada.

É recomendável usar um arquivo js, como o @Pedro_H_Victorino disse, mas só vai resolver o problema se estiver carregando os scripts no navegador.

Se ainda não der certo, pode tentar fazer aquilo que vc disse, colocar o script na outra página.

Criado 20 de fevereiro de 2017
Ultima resposta 24 de fev. de 2017
Respostas 16
Participantes 3