Problema RichFaces!

3 respostas
D

Olá,

Estou desenvolvendo uma aplicação web com JSF, RICHfaces, My faces TomaHawk e facelets.

Estou com um problema, no caso tem uma tela de menu e ao clicar no botão quero chamar uma tela como exmlpo de um CRUD basico.

So que quero que a mesma venha em um modalPanel, até ai tudo bem esta vindo correto. Porem os botões ficam sem funcionalidade nenhuma.

Ex :

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">

    <h:form>

<rich:modalPanel id="panel" width="350" height="100">
        <f:facet name="header">
            <h:panelGroup>
                <h:outputText value="Modal Panel"></h:outputText>
            </h:panelGroup>
        </f:facet>
        <f:facet name="controls">
            <h:panelGroup>
                <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
                <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
            </h:panelGroup>
        </f:facet>
        <a4j:include viewId="/teste/teste.xhtml" id="inc">
    </rich:modalPanel>



        <rich:toolBar>
<rich:dropDownMenu>
                <f:facet name="label"> 
                    <h:panelGroup>                    
                        <h:outputText value="File"/>
                    </h:panelGroup>
                </f:facet>
                <rich:menuItem submitMode="ajax" value="Teste" onClick="javascript.Richfaces.ShowModalPanel('panel')"
                </rich:menuItem>
</rich:dropDownMenu>
        </rich:toolBar>
    </h:form>

3 Respostas

thiagodavala

Dae cara blza?

Estou com o mesmo problema quando uso a função a4j:support do Richfaces, porém quando se trata de botões e essas coisas eu estou utilizando dentro do modalpanel um <a4j:form ajaxSubmit=“true” > e dentro estou utilizando botões e links do tipo a4j:commandbutton e a4j:commandlink e ae funciona corretamente, só mais uma coisa não esquece de da uma olhada no reRender do botão ou do link que tu vai usar para atualizar o lugar que tu precisa. flw.

Att.

D

coloca a pagina dos botoes de vcs ae pra gente poder ajudar :wink:

[]'s

D

opa
ta ae o resto

template

<?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"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:t="http://myfaces.apache.org/tomahawk">
	<head>
		<style>
			 .headP {		        		        		        
		        height:18px;
		        text-align:center;
		        vertical-align:middle;		        
		        padding:4px 0;	           
		    }	    
		</style>
		<title>
			
			<ui:insert name="title">
				My Crud Template
			</ui:insert>
		</title>
		<ui:insert name="head">
		</ui:insert>
	</head>
	<body>
		 <f:view id="teste">
		<!-- bloco principal -->				
			<a4j:outputPanel ajaxRendered="true" id="mainOutputPanel" showWhenRendered="true">								
				<a4j:form ajaxSubmit="true">	
				
			<!-- Botões -->
			<rich:toolBar itemSeparator="line">								
				<rich:toolBarGroup>
					<a4j:commandLink action="#{defaultBean.prepareAdicionar}" immediate="true" reRender="mainOutputPanel">
						<h:graphicImage value="/imagens/Novo.gif"></h:graphicImage>
					</a4j:commandLink>																								
				</rich:toolBarGroup>				
				<rich:toolBarGroup location="right">
        			<h:graphicImage value="/imagens/Sair.gif"></h:graphicImage>
        		</rich:toolBarGroup>
			</rich:toolBar>
				<rich:panel id="parametro" rendered="#{defaultBean.pesquisarState}" headerClass="headP">
					<f:facet name="header">								
						Parâmetros para a busca
			        </f:facet>
			        <ui:insert name="parametro">
					</ui:insert>		

				</rich:panel>		
																
				<!-- Localizar -->
				<rich:panel id="searchlistBlock" rendered="#{defaultBean.pesquisarState}" headerClass="headP" >				
					<f:facet name="header">
						Resultados
			        </f:facet>
			<!-- Botões -->
			<rich:toolBar itemSeparator="line">
				<rich:toolBarGroup>			
					<h:graphicImage value="/imagens/Rel.gif"></h:graphicImage>																													
				</rich:toolBarGroup>
				<rich:toolBarGroup>
        			<h:graphicImage value="/imagens/RelHtml.gif"></h:graphicImage>
        			<h:graphicImage value="/imagens/RelXml.gif"></h:graphicImage>
        			<h:graphicImage value="/imagens/RelTxt.gif"></h:graphicImage>
        		</rich:toolBarGroup>	
        	</rich:toolBar>		        						        
					<ui:insert name="resultado">
					</ui:insert>
				</rich:panel>								
				
				<!-- bloco de edição -->
				<rich:panel id="addUpdateBlock"
							rendered="#{defaultBean.adicionarState or defaultBean.editarState}">
					<f:facet name="header">
						Dados do Usuário
			        </f:facet>
					<ui:insert name="addUpdateBlock">
					</ui:insert>					
				</rich:panel>
				
				</a4j:form>	

			</a4j:outputPanel>
		</f:view>
	</body>
</html>

pagina teste.xhtml mas com outro nome hehe

<?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">


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				xmlns:c="http://java.sun.com/jstl/core"
				template="/template/TemplateCrud.xhtml">
								
			
	<!-- passa parâmetro para o template -->
	<ui:param name="defaultBean" value="#{profissaoBean}" />
	
	<ui:define name="title">
		Cadastro de Profissões
		<t:saveState id="_bean" value="#{profissaoBean}" />
	</ui:define>
	
	<ui:define name="head">
		<style  type="text/css">
	        .odd-row {
	            background-color: #ECF3FE;
	        }
	        .even-row {
	            background-color: #FCFFFE;
	        }
	        .active-row {
            	background-color: #FFEBDA;
       		}
	    </style>
	</ui:define>
	<ui:define name="novo">
		<a4j:commandLink value="Adicionar" action="#{profissaoBean.prepareAdicionar}" />
	</ui:define>	
	<!-- define searchlistBlock -->
	<ui:define name="parametro">
		<h:panelGrid columns="1">
			<h:column>
				<h:outputText value="Id:" />
				<br/>
				<h:inputText value="#{profissaoBean.desc}" size="30" />
			</h:column>
			<h:column>
				<a4j:commandButton value="Pesquisar" action="#{profissaoBean.pesquisar}"/>				
			</h:column>
		</h:panelGrid>
	</ui:define>
	<ui:define name="resultado">
		
		<rich:datascroller align="center" for="profList" maxPages="10" />
		<rich:spacer height="20" />
		<rich:dataTable width="600"  id="profList" rows="10" align="center" 
			rowClasses="odd-row,even-row"
			columnClasses="col" value="#{profissaoBean.profissoes}" var="row">													
			<rich:column sortBy="#{row.id_profissao}">						
				<f:facet name="header">
					<h:outputText styleClass="headerText" value="ID" />						
				</f:facet>
				<h:outputText value="#{row.id_profissao}" />
			</rich:column>
			<rich:column sortBy="#{row.ds_profissao}">
				<f:facet name="header">
					<h:outputText styleClass="headerText" value="Profissão" />
				</f:facet>
				<h:outputText value="#{row.ds_profissao}" />
			</rich:column>						
			<rich:column>
				<span>
					<a4j:commandLink action="#{profissaoBean.prepareEditar}" immediate="true">
						<h:graphicImage value="/imagens/Editar.gif"></h:graphicImage>
						<f:setPropertyActionListener value="#{row}" target="#{profissaoBean.profissao}"/>
					</a4j:commandLink>
				</span>
				<span>
					<a4j:commandLink action="#{profissaoBean.excluir}" immediate="true">
						<h:graphicImage value="/imagens/Excluir.gif"></h:graphicImage>
						<f:setPropertyActionListener value="#{row}" target="#{profissaoBean.profissao}"/>
					</a4j:commandLink>
				</span>
			</rich:column>
		</rich:dataTable>		
		  <rich:jQuery selector="profList tr:odd" query="addClass('odd-row')" />
            <rich:jQuery selector="profList tr:even" query="addClass('even-row')" />
            <rich:jQuery selector="profList tr" 
                query="mouseover(function(){jQuery(this).addClass('active-row')})"/>
            <rich:jQuery selector="#userList tr" 
                query="mouseout(function(){jQuery(this).removeClass('active-row')})"/>	
	</ui:define>
	
	<!-- define addUpdateBlock -->
	<ui:define name="addUpdateBlock">
		<h:panelGrid columns="2" id="panel2" binding="#{profissaoBean.panelForm}" columnClasses="odd-row,even-row">
			<h:outputLabel value="Profissão: "/>
			<h:column>
				<h:inputText value="#{profissaoBean.profissao.ds_profissao}" size="60" required="true" id="profissao"
							requiredMessage="Campo Profissao é obrigatório." />	
				<br/>
				<h:message for="nome" errorStyle="color: darkred;"/>
			</h:column>			
		</h:panelGrid>
		<a4j:commandButton value="Adicionar" action="#{profissaoBean.adicionar}" rendered="#{profissaoBean.adicionarState}"/>
		<a4j:commandButton value="Editar" action="#{profissaoBean.editar}" rendered="#{profissaoBean.editarState}"/>
		<a4j:commandButton value="Voltar" action="#{profissaoBean.voltar}" immediate="true"/>
	</ui:define>
	
</ui:composition>
Criado 30 de julho de 2008
Ultima resposta 30 de jul. de 2008
Respostas 3
Participantes 3