Pegando registro errado(dataTable)

1 resposta
Agr0

Pessoal, toda vez q clico em algum botão para fazer algo com aquele registo(ver detalhes, editar…) acaba pegando o registro errado(80% das vezes). O que pode estar acontecendo? Será algo na session? Nunca tive um problema parecido :confused:
Vou colocar a página aqui. Obrigado!

<?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:p="http://primefaces.org/ui">

<ui:composition template="/templates/interna.xhtml">
	<ui:define name="corpo">
		<h:panelGrid columns="1" width="98%" id="listaTarefa" style="margin-left:auto; margin-right:auto;">
			<p:panel id="tam" header="Lista de tarefas">

				<h:form id="buscando">

					<h:messages />
					
					<br/>
						  <h:outputText value="Você tem" style="color:blue;font-weight:bold"/> &nbsp;  	
				  		  <h:outputText value="#{tarefaBean.quantidadeTarefas}" style="color:red; font-weight:bold" size="30" title="Protocolos novos"/> &nbsp;  
				  		  <h:outputText value="tarefa(s) pendente(s)." style="color:blue;font-weight:bold"/>	 
				  		  <h:graphicImage library="imagens" name="tarefa.png"/>
					
					 <br/><br/>
					 <h:panelGrid columns="1" width="45%">
					 <p:panel header="Filtro" columns="3" >
             		 <br/>
             		
             			<h:selectOneMenu value ="#{tarefaBean.filtroBuscaTarefa}">
 							<f:selectItem itemLabel="Nome da tarefa" itemValue="t"/>  
 							<f:selectItem itemLabel="Nome do projeto" itemValue="p"/>
 							<f:selectItem itemLabel="Nome do atendente" itemValue="a"/> 
 							<f:selectItem itemLabel="Nome do solicitante" itemValue="s"/>
 							<f:selectItem itemLabel="Status da tarefa" itemValue="st"/>
 						</h:selectOneMenu> 
 						&nbsp;
 					<p:inputText id="campoBuscaTarefa" label="campoBuscaTarefa" value="#{tarefaBean.campoBuscaTarefa}" />&nbsp;
					<h:commandButton action="#{tarefaBean.escolhaBusca}" value="Listar"/><br/>
								
           		 </p:panel>
            </h:panelGrid>	
			<br/>
			<br/><br/>
						<p:dataTable id="listaProjeto" value="#{tarefaBean.tarefas}"
						var="tarefa" rows="10" cellpadding="5" paginator="true"
						emptyMessage="Nenhum registro encontrado">

						<f:facet name="caption">

							<br />
						</f:facet>

						<p:column width="4%">
							<f:facet name="header">#</f:facet>
							<h:outputText value="#{tarefa.tarefa}" />
						</p:column>

						<p:column width="20%" style="white-space:normal !important;">
							<f:facet name="header">Nome</f:facet>
							<h:outputText value="#{tarefa.nome}" />
						</p:column>

						<p:column style="white-space:normal !important;" width="20%">
							<f:facet name="header">Início</f:facet>
							<h:outputText value="#{tarefa.dataInicio}">
								<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
							</h:outputText>
						</p:column>
						
						<p:column style="white-space:normal !important;" width="20%">
							<f:facet name="header">Prazo</f:facet>
							<h:outputText value="#{tarefa.dataPrazo}">
								<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
							</h:outputText>
						</p:column>
						
						<p:column style="white-space:normal !important;" width="20%">
							<f:facet name="header">Fim</f:facet>
							<h:outputText value="#{tarefa.dataFim}">
								<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
							</h:outputText>
						</p:column>
						
						<p:column style="white-space:normal !important;" width="12%">
							<f:facet name="header">Projeto</f:facet>
							<h:outputText value="#{tarefa.projeto.nome}" />
						</p:column>
						
						<p:column style="white-space:normal !important;" width="15%">
							<f:facet name="header">Atendente</f:facet>
							<h:outputText value="#{tarefa.usuarioAtendente.nome}"/>
						</p:column>
						
						<p:column style="white-space:normal !important;" width="15%">
							<f:facet name="header">Solicitante</f:facet>
							<h:outputText value="#{tarefa.usuarioSolicitante.nome}" />
						</p:column>
						
						<p:column style="white-space:normal !important;" width="15%">
							<f:facet name="header">Status</f:facet>
							<h:outputText value="#{tarefa.statusTarefa.nome}"/>
						</p:column>
						

					
						<p:column  width="4%">
							<h:commandLink action="#{tecnicoSessaoBean.editarTarefa}">
								<h:graphicImage library="imagens" name="itens_req.png"
									style="border:0" title="Editar" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.codigoTarefa}"
									value="#{tarefa.tarefa}" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.nomeTarefa}" value="#{tarefa.nome}" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.dataInicioTarefa}" value="#{tarefa.dataInicio}"/>
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.dataPrazoTarefa}" value="#{tarefa.dataPrazo}"/>
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.dataFimTarefa}" value="#{tarefa.dataFim}" />	
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.usuario}"
									value="#{tarefa.usuarioAtendente.nome}" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.usuario2}"
									value="#{tarefa.usuarioSolicitante.nome}" />	
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.projeto}"
									value="#{tarefa.projeto.nome}" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.descricaoSolicitanteTarefa}"
									value="#{tarefa.descricaoSolicitante}" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.descricaoAtendenteTarefa}"
									value="#{tarefa.descricaoAtendente}" />	
									
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.statusTarefa}"
									value="#{tarefa.statusTarefa.nome}" />	
								</h:commandLink>
						</p:column>
								
						<p:column  width="4%">
							<h:commandLink action="#{tarefaBean.verDetalhe}">
								<h:graphicImage library="imagens" name="detalhe.png"
									style="border:0" title="Ver detalhes"/>
								<f:setPropertyActionListener
									target="#{tarefaBean.codigoTarefa}"
									value="#{tarefa.tarefa}"/>		
							</h:commandLink>
						</p:column>		
						
						<p:column  width="4%">
							<h:commandLink action="#{tecnicoSessaoBean.mudarAtendente}" onclick="if (!confirm('Deseja pegar essa tarefa?')) return false;">
								<h:graphicImage library="imagens" name="pegartarefa.png"
									style="border:0" title="Pegar tarefa" />
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.codigoTarefa}"
									value="#{tarefa.tarefa}"/>		
							</h:commandLink>
						</p:column>		
								
							<p:column>
							<p:commandButton id="selectButton" update=":buscando:display2"
								oncomplete="carDialog.show()" icon="ui-icon-circle-check"
								title="Estoque">
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.codigoTarefa}"
									value="#{tarefa.tarefa}"/>
								<f:setPropertyActionListener
									target="#{tecnicoSessaoBean.descricaoSolicitanteTarefa}"
									value="#{tarefa.descricaoSolicitante}" />	
							</p:commandButton>

						</p:column>
								
						
					</p:dataTable>
										
					<p:dialog header="Finalizar tarefa" widgetVar="carDialog"
							resizable="false" id="carDlg" showEffect="fade"
							hideEffect="explode" modal="true">
							<h:panelGrid id="display2" columns="2" cellpadding="4"
							style="margin:0 auto;">

							<h:outputText value="#:" />
							<h:outputText value="#{tecnicoSessaoBean.codigoTarefa}"
								style="font-weight:bold" />
								
							<p:outputLabel value="Descrição solicitante:" />
							<h:outputText value="#{tecnicoSessaoBean.descricaoSolicitanteTarefa}"
							style="font-weight:bold"/>	
							
							<p:outputLabel value="Descrição atendente:" for="descricaoAtendente" />
							<p:inputTextarea id="descricaoAtendente" label="descricaoAtendente"
							value="#{tecnicoSessaoBean.descricaoAtendenteTarefa}" cols="80" rows="5" maxlength="400"/>
						
							<h:commandButton action="#{tecnicoSessaoBean.finalizarTarefa}" value="Finalizar"/>	
						
							</h:panelGrid>
					</p:dialog>	
			
				</h:form>
			</p:panel>
		</h:panelGrid>
	</ui:define>
</ui:composition>
</html>

1 Resposta

Agr0

O problema é esse p:panel!

<h:panelGrid columns="1" width="45%">
						<p:panel id="filtroItem" header="Filtro" columns="3">

							<h:selectOneMenu value="#{tarefaBean.filtroBuscaTarefa}">
								<f:selectItem itemLabel="Nome da tarefa" itemValue="t" />
								<f:selectItem itemLabel="Nome do projeto" itemValue="p" />
								<f:selectItem itemLabel="Nome do atendente" itemValue="a" />
								<f:selectItem itemLabel="Nome do solicitante" itemValue="s" />
								<f:selectItem itemLabel="Status da tarefa" itemValue="st" />
							</h:selectOneMenu> 
 						&nbsp;
 					<p:inputText id="campoBuscaTarefa" label="campoBuscaTarefa"
								value="#{tarefaBean.campoBuscaTarefa}" />&nbsp;
					<h:commandButton action="#{tarefaBean.escolhaBusca}" value="Listar" />
							<br />
						</p:panel>
					</h:panelGrid>

Se eu retirar ele tudo funciona corretamente. Pq isso está acontecendo ?

Criado 12 de maio de 2016
Ultima resposta 12 de mai. de 2016
Respostas 1
Participantes 1