Galera tenho uma tabela e utilizo um dialog para confirmar a exclusão, só que ao excluir ele pega o primeiro item da lista, não exclui a linha que eu cliquei para excluir.
segue o codigo
<p:dataTable id="dtTarefas" var="tar" rowKey="#{tar.codigo}"
value="#{atendimentoBean.modelo.tarefas}"
columnClasses="columnCenter,columnCenter">
<p:column headerText="Prioridade"
style="max-width: 35px; min-width: 35px; overflow: hidden">
<h:outputText value="#{tar.ordem.ordem}" />
</p:column>
<p:column headerText="#{msg.TITULO_DESCRICAO}"
style="max-width: 220px; min-width: 220px; overflow: hidden">
<h:outputText value="#{tar.descricao}" />
</p:column>
<p:column headerText="Status"
style="max-width: 50px; min-width: 50px; overflow: hidden">
<h:outputText value="#{tar.status.descricao}" />
</p:column>
<p:column headerText="#{msg.TITULO_CONCLUSAO}"
style="max-width: 40px; min-width: 40px; overflow: hidden">
<h:outputText value="#{tar.dataConcluido.time}">
<f:convertDateTime pattern="dd/MM/yyyy" locale="pt" />
</h:outputText>
</p:column>
<p:column headerText="#{msg.TITULO_ACOES}"
style="max-width: 37px; min-width: 37px; overflow: hidden">
<p:commandButton id="btnAlteraTarefa" icon="alterartable"
styleClass="botaoTable"
title="#{msg.LEGENDA_ALTERAR} #{msg.CAMPO_TAREFA}"
oncomplete="rcAtualizaDadosTarefa()"
disabled="#{not atendimentoBean.habilitado}"
style="background-color: transparent;border:0px;"
action="#{atendimentoBean.alteraTarefa(tar)}" />
<p:commandButton id="showDialogButton" icon="excluirtable"
styleClass="botaoTable" oncomplete="confirmation.show()"
title="#{msg.LEGENDA_EXCLUIR} #{msg.CAMPO_TAREFA}"
disabled="#{not atendimentoBean.habilitado}"
style="background-color: transparent;border:0px;vertical-align:top;" />
</p:column>
</p:dataTable>
<p:confirmDialog id="confirmDialog"
message="Confirma excluir esse registro?"
header="#{msg.LEGENDA_CONFIRMAR}" severity="alert"
widgetVar="confirmation">
<p:commandButton id="confirm" value="#{msg.CAMPO_SIM}"
action="#{atendimentoBean.removeTarefa(tar)}"
update="dtTarefas" oncomplete="confirmation.hide()" />
<p:commandButton id="decline" value="#{msg.CAMPO_NAO}"
onclick="confirmation.hide()" type="button" />
</p:confirmDialog>