Pessoal estou tentando chamar uma actionListener dentro de um h:commandLink porém não estou tendo sucesso.
Quando mudo para a4j:commandLink o evento é chamado porém o rich:modalPanel abre e fecha rapidamente, já tentei várias soluções aqui do fórum como por exemplo tirar o modalPanel de dentro de form principal e colocar outro form dentro mas o problema continua.
Preciso de um help ja perdi muito tempo tentando resolver esse problema.
Segue o código.
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<f:subview id="Cronograma">
<h:form>
<h:panelGroup id="cronograma" style="text-align: center">
<table width="80%" align="center" cellspacing="0" style="border-width: 1px; border-style: solid">
<tr>
<td colspan="4" align="left"><font size="5"><h:outputText value="Cronograma" /></font><br /></td>
</tr>
<tr>
<td><h:outputText value="Filtrar por:"/></td>
<td>
<h:selectOneMenu>
<f:selectItem itemLabel="Todos" itemValue=""/>
<f:selectItem itemLabel="Nome" itemValue=""/>
<f:selectItem itemLabel="Data inclusão" itemValue=""/>
<f:selectItem itemLabel="Data término" itemValue=""/>
</h:selectOneMenu>
</td>
<td>
<h:inputText value="" size="40" />
<h:graphicImage id="imgFil" url="/imagens/btlLupa.png" style="border:0" title="Pesquisar"/>
</td>
</tr>
<tr>
<td>
<h:graphicImage title="Adicionar Tarefa" id="imgEnt" url="/imagens/btlAdd.gif" style="border:0" onclick="#{rich:component('mpTarefa')}.show()" />
</td>
</tr>
<tr>
<td colspan="6">
<rich:dataTable value="#{tarefaMB.listaTarefas}" var="tarefa" rows="10"
onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
columnsWidth="50%,10%,10%,20%,5%,5%" id="lstTarefas"
style="align:center">
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="Título"/>
</rich:column>
<rich:column>
<h:outputText value="Data inicial" />
</rich:column>
<rich:column>
<h:outputText value="Data término" />
</rich:column>
<rich:column>
<h:outputText value="Status" />
</rich:column>
<rich:column/>
<rich:column/>
<rich:column/>
</rich:columnGroup>
</f:facet>
<rich:column style="background-color:#EEEEE0">
<h:outputText value="#{tarefa.tituloTar}" />
</rich:column>
<rich:column style="background-color:#EEEEE0">
<h:outputText value="#{tarefa.dataInicialTar}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy" dateStyle="medium"/>
</h:outputText>
</rich:column>
<rich:column style="background-color:#EEEEE0">
<h:outputText value="#{tarefa.dataTerminoTar}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy" dateStyle="medium"/>
</h:outputText>
</rich:column>
<rich:column style="background-color:#EEEEE0">
<h:outputText value="#{tarefa.statusTar}" />
</rich:column>
<rich:column style="background-color:#EEEEE0;align:center" >
<h:commandLink>
<h:graphicImage id="imgEdt" url="/imagens/btlEdit.png" style="border:0" title="Editar Tarefa"/>
</h:commandLink>
</rich:column>
<rich:column style="background-color:#EEEEE0;align:center">
<h:commandLink >
<h:graphicImage id="imgDel" url="/imagens/btlDelete.png" style="border:0" title="Excluir Tarefa"/>
</h:commandLink>
</rich:column>
<rich:column style="background-color:#EEEEE0;align:center">
<h:commandLink actionListener="#{tarefaMB.changeSelectedTerefa}" >
<h:graphicImage id="imgNew" url="/imagens/btlAddAtividade.gif" style="border:0" title="Incluir Atividade" onclick="#{rich:component('mpAtividade')}.show()" />
</h:commandLink>
</rich:column>
<rich:subTable value="#{tarefa.listaAtividades}" var="atividade"
onRowMouseOver="this.style.backgroundColor='#E0E0E0'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
<f:facet name="header">
<rich:columnGroup>
<rich:column width="50%">
<h:outputText value="Título"/>
</rich:column>
<rich:column width="10%" >
<h:outputText value="Data Inicial"/>
</rich:column>
<rich:column width="10%">
<h:outputText value="Data Término"/>
</rich:column>
<rich:column width="20%">
<h:outputText value="% Concluído"/>
</rich:column>
<rich:column style="align:center"/>
<rich:column style="align:center"/>
<rich:column style="align:center"/>
</rich:columnGroup>
</f:facet>
<rich:column style="align:center">
<h:outputText value="#{atividade.tituloAti}" />
</rich:column>
<rich:column style="align:center">
<h:outputText value="#{atividade.dataInicialAti}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy" dateStyle="medium"/>
</h:outputText>
</rich:column>
<rich:column style="align:center">
<h:outputText value="#{atividade.dataConclusaoAti}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy" dateStyle="medium"/>
</h:outputText>
</rich:column>
<rich:column>
<h:outputText value="#{atividade.percentConcluAti}" />
</rich:column>
<rich:column >
<h:commandLink>
<h:graphicImage id="imgEdt" url="/imagens/btlEdit.png" style="border:0" />
</h:commandLink>
</rich:column>
<rich:column >
<h:commandLink>
<h:graphicImage id="imgDel" url="/imagens/btlDelete.png" style="border:0" />
</h:commandLink>
</rich:column>
<rich:column></rich:column>
</rich:subTable>
</rich:dataTable>
</td>
</tr>
<tr>
<td colspan="6" align="center">
<br/>
<rich:datascroller for="lstTarefas"></rich:datascroller>
</td>
</tr>
</table>
</h:panelGroup>
<!-- Panel tarefa -->
<rich:modalPanel id="mpTarefa" resizeable="true" height="310" width="600" zindex="1000">
<table>
<f:facet name="header">
<h:outputText value="Tarefa"/>
</f:facet>
<tr>
<td><h:outputText value="Titulo" /></td>
<td><h:inputText value="#{tarefaMB.tarefa.tituloTar}" size="40" /></td>
</tr>
<tr>
<td><h:outputText value="Data Inicial" /></td>
<td><rich:calendar value="#{tarefaMB.tarefa.dataInicialTar}" locale="pt_BR" datePattern="dd/MM/yyyy"
cellWidth="24px" cellHeight="22px" style="width:200px"/>
</td>
</tr>
<tr>
<td><h:outputText value="Data término" /></td>
<td><rich:calendar value="#{tarefaMB.tarefa.dataTerminoTar}" locale="pt_BR" datePattern="dd/MM/yyyy"
cellWidth="24px" cellHeight="22px" style="width:200px"/>
</td>
</tr>
<tr>
<td><h:outputText value="Descrição" /></td>
<td>
<h:inputTextarea value="#{tarefaMB.tarefa.descricaoTar}" rows="4" cols="40"></h:inputTextarea>
</td>
</tr>
<tr>
<td>
<h:commandButton value="Enviar" action="#{tarefaMB.incluirTarefa}" onclick="#{rich:component('mpTarefa')}.hide()">
<a4j:support event="onsubmit" reRender="lstTarefas" ></a4j:support>
</h:commandButton>
<h:commandButton value="Cancelar" onclick="#{rich:component('mpTarefa')}.hide()" />
</td>
</tr>
</table>
</rich:modalPanel>
<!-- Panel de Atividade -->
<rich:modalPanel id="mpAtividade" resizeable="false" height="250" width="600" zindex="1000" onshow="#{rich:component('mpAtividade')}.show()">
<table>
<f:facet name="header">
<h:outputText value="Atividade"/>
</f:facet>
<tr>
<td><h:outputText value="Titulo" /></td>
<td><h:inputText value="#{tarefaMB.atividade.tituloAti}" size="40" /></td>
</tr>
<tr>
<td><h:outputText value="Data Inicial" /></td>
<td><rich:calendar value="#{tarefaMB.atividade.dataInicialAti}" locale="pt_BR" datePattern="dd/MM/yyyy"
cellWidth="24px" cellHeight="22px" style="width:200px"/>
</td>
</tr>
<tr>
<td><h:outputText value="Data término" /></td>
<td><rich:calendar value="#{tarefaMB.atividade.dataConclusaoAti}" locale="pt_BR" datePattern="dd/MM/yyyy"
cellWidth="24px" cellHeight="22px" style="width:200px"/>
</td>
</tr>
<tr>
<td><h:outputText value="Descrição" /></td>
<td>
<h:inputTextarea value="#{tarefaMB.atividade.descricaoAti}" rows="4" cols="40"></h:inputTextarea>
</td>
</tr>
<tr>
<td>
<h:commandButton action="#{tarefaMB.incluirAtividade}" value="Enviar" onclick="#{rich:component('mpAtividade')}.hide()">
<a4j:support event="onsubmit" reRender="lstTarefas" ></a4j:support>
</h:commandButton>
<h:commandButton value="Cancelar" onclick="#{rich:component('mpAtividade')}.hide()" />
</td>
</tr>
</table>
</rich:modalPanel>
</h:form>
</f:subview>
</html>
Obs: o problema ocorre apenas no modalPanel atividade quando é usado o a4j:commandLink.