title: primefaces datatable selected row always the same value
body: <p>I have a datatable with custom delete button when I try to send the id of the selected row to the backing bean, but i always get the same value, this is my code:</p>
  
  <pre><code>&lt;p:dataTable id="result" var="service" value="#{bean.services}" editable="true"&gt; 
  &lt;!--  ajax --&gt;
  &lt;p:ajax event="rowEdit" listener="#{bean.onEdit}" update=":form:msg" /&gt;
  &lt;p:ajax event="rowEditCancel" listener="#{bean.onCancel}" update=":form:msg" /&gt;   
  .....
  &lt;p:column headerText="delete" style="width:100px;"&gt;
  &lt;p:confirmDialog id="confirmation" message="are u sure?" header="delete item" widgetVar="confirmation" showEffect="fade" hideEffect="explode"&gt;
  &lt;p:commandButton value="Yes"  onclick="PF('confirmation').hide()" actionListener="#{bean.onDeleteRow}"&gt;
  &lt;f:setPropertyActionListener target="#{bean.cve}" value="#{service.id.cve}" /&gt;
  &lt;/p:commandButton&gt;  
  &lt;p:commandButton value="No" onclick="PF('confirmation').hide()" type="button" /&gt;   
  &lt;/p:confirmDialog&gt;
  &lt;p:commandLink id="deleteLink"  onclick="PF('confirmation').show()" styleClass="ui-icon ui-icon-trash"/&gt;                              
  &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>here is the baking bean code:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  @SuppressWarnings("serial")
  public class Bean implements Serializable{
  
  private String cve;
  
  ...
  
  public void setcve(String cve) {
      this.cve = cve;
  }
  
  ....    
  
  public void onDeleteRow(){
  
  try {
  System.out.println("delete--&gt;" + this.cve );
  } catch (Exception e) {
  e.printStackTrace();
  }
  
  }
  
  }
  </code></pre>
  
  <p>In the tag  you can see the value that I'm sending as a parameter but I always leave the last value of datatable ... </p>
  
  <p>What am I doing wrong? </p>
  
  <p>Thank you very much for the support</p>