Bom dia pessoal!!!
Sou iniciante no jsf, e estou com uma dúvida. Eu tenho uma tela com um panelGrid que me mostra vários registros de uma tabela do banco. Tenho também um campo de busca onde eu busco pelo nome do registro e um novo panelGrid é renderizado com os resultados da busca. A minha dúvida é:
Como eu faço para que o primeiro panelGrid desapareça e o segundo panel com o resultado da busca entre no lugar dele. Do jeito que está aqui, o panelGrid de busca é renderizado em cima do outro panel e entao, ficam os dois na tela ao mesmo tempo, quando deveria ficar só um.
Aí vai meu xhtml para ficar mais claro.
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<title>GA - Pré-tarefas Cadastradas</title>
</h:head>
<h:body>
<h:panelGroup id="preTarefaWrapper">
<h:form>
<h:outputText value="Pré-tarefas Cadastradas"/>
<br/>
<br/>
<h:outputText value="Filtro por nome"/><br/>
<h:inputText value="#{preTarefaController.nome}"/>
<br/>
<h:commandButton action="#{preTarefaController.buscarPorNome}" value="Filtrar">
</h:commandButton>
<br/>
<br/>
<h:panelGroup rendered="#{not empty preTarefaController.buscaPorNomeList}">
<h:panelGrid columns="2" border="0" rules="rows">
<f:facet name="header">
<h:outputText value="Pré-Tarefas"/>
</f:facet>
<ui:repeat var="preTarefa" value="#{preTarefaController.buscaPorNomeList}">
<tr>
<td>
<h:outputText value="#{preTarefa.nome}"/>
</td>
<td>
<a >Editar</a>
<h:commandLink value="Excluir">
<rich:componentControl target="popup" operation="show" />
</h:commandLink>
<br/>
</td>
</tr>
<rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Excluir Pré-Tarefa" />
</f:facet>
<p>
<h:form>
<h:outputText value="Deseja realmente excluir esta pré-tarefa?"/><br/><br/>
<h:commandButton id="excluir" onclick="#{rich:component('popup')}.hide()" value="Sim">
<f:ajax listener="#{preTarefaController.remover(preTarefa)}" render=":preTarefaWrapper"/>
</h:commandButton>
<h:message for="excluir"/>
<h:commandButton id="excluirTarefa" onclick="#{rich:component('popup')}.hide()" value="Não"/>
</h:form>
</p>
</rich:popupPanel>
</ui:repeat>
</h:panelGrid>
</h:panelGroup>
<br/>
<h:panelGroup rendered="#{not empty preTarefaController.preTarefaList}">
<h:panelGrid columns="2" border="0" rules="rows">
<f:facet name="header">
<h:outputText value="Pré-Tarefas" />
</f:facet>
<ui:repeat var="preTarefa" value="#{preTarefaController.preTarefaList}">
<tr>
<td>
<h:outputText value="#{preTarefa.nome}"/>
</td>
<td>
<a >Editar</a>
<h:commandLink value="Excluir">
<rich:componentControl target="popup" operation="show" />
</h:commandLink>
<br/>
</td>
</tr>
<rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Excluir Pré-Tarefa" />
</f:facet>
<p>
<h:form>
<h:outputText value="Deseja realmente excluir esta pré-tarefa?"/><br/><br/>
<h:commandButton id="excluir" onclick="#{rich:component('popup')}.hide()" value="Sim">
<f:ajax listener="#{preTarefaController.remover(preTarefa)}" render=":preTarefaWrapper"/>
</h:commandButton>
<h:message for="excluir"/>
<h:commandButton id="excluirTarefa" onclick="#{rich:component('popup')}.hide()" value="Não"/>
</h:form>
</p>
</rich:popupPanel>
</ui:repeat>
</h:panelGrid>
</h:panelGroup>
<h:panelGroup rendered="#{empty preTarefaController.preTarefaList}">
<h:outputText value="Nenhuma pré-tarefa encontrada."/>
</h:panelGroup>
</h:form>
</h:panelGroup>
</h:body>
</html>
Agradeço desde já quem puder me dar uma ajuda com isso!!! Obrigado!!