title: primefaces: confirm dialog button not calling managedbean method
body: <p>I am working in primefaces 3.3 and jsf 2.0. I have problem in deleting record in lazy datamodel. As sorting and filtering is not working properly in datatable I had to use lazydatamodel concept.Now save(through wizard), edit,sorting and filtering are working fine. When I tried to delete record from datatable, dialog is appearing and when I click on yes(command button) to delete record, instead of calling bean method control goes to load method of lazy data model. deleterecord of clientUitility.java(managedbean) not calling. can anyone give me guidance to delete record from datatable by passing client object
  Here is code snippet</p>
  
  <p>clientMaster.xhtml</p>
  
  <pre><code> &lt;h:form id="cm"&gt;
                  &lt;p:growl life="5000" showDetail="true" showSummary="true" id="mymessage" /&gt;
                  &lt;p:wizard widgetVar="wiz" flowListener="#{clientUitility.onFlowProcess}" showNavBar="true" &gt;
                      &lt;p:tab id="personal" title="Personal" &gt;
  .....
  .....// tab and columns
  .....
  
                                          &lt;p:commandButton id="addClient" immediate="true" value="Add Client" actionListener="#{clientUitility.save}" oncomplete="wiz.loadStep (wiz.cfg.steps [0], true)" update=":fce:clientList" &gt; &lt;!-- update="@parent,:cm:clientList" --&gt;
                                          &lt;/p:commandButton&gt;
                                      &lt;/p:column&gt;
                                  &lt;/p:row&gt;
                              &lt;/p:panelGrid&gt;
                          &lt;/p:panel&gt;
                      &lt;/p:tab&gt;
                  &lt;/p:wizard&gt;
              &lt;/h:form&gt;
              &lt;ui:include id="ce" src="ClientEditDatatable.xhtml"/&gt;
  </code></pre>
  
  <p>ClientEditdatatable.xhtml</p>
  
  <pre><code>&lt;h:form id="fce"&gt;
  
  
          &lt;p:dataTable var="client" value="#{clientUitility.lazyModel}" id="clientList" editable="true" widgetVar="clientTable" rowKey="#{client.clientID}"
                       paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                       paginator="true" rows="10" rowsPerPageTemplate="5,10,15" lazy="true"&gt;
  
              &lt;p:column headerText="First Name" style="width:100px" filterBy="#{client.firstName}" sortBy="#{client.firstName}" &gt;
                  &lt;p:cellEditor&gt;
                      &lt;f:facet name="output"&gt;
                          &lt;h:outputText value="#{client.firstName}" /&gt;
                      &lt;/f:facet&gt;
                      &lt;f:facet name="input"&gt;
                          &lt;p:inputText id="dtFirstName" value="#{client.firstName}" style="width:100%" label="FirstName" onkeyup="valid(this)" onblur="convertUpper(this.id)"  &gt;
                              &lt;f:validateLength for="dtFirstName" maximum="100" minimum="3"/&gt;
                          &lt;/p:inputText&gt;
                      &lt;/f:facet&gt;
                  &lt;/p:cellEditor&gt;
              &lt;/p:column&gt;
  .....
  ..... // code of column
  .....
              &lt;p:ajax event="rowEdit" listener="#{clientUitility.editRowListner}" update=":cm:mymessage"/&gt;
              &lt;p:column headerText="Delete" style="width:50px"&gt;
                  &lt;p:commandButton id="deleteClient" value="Delete" onclick="confirmDeleteClient.show()" title="Delete this Client" styleClass="ui-icon-trash"&gt;
                      &lt;f:setPropertyActionListener target="#{client}" value="#{clientUitility.client}"/&gt;
                  &lt;/p:commandButton&gt;
              &lt;/p:column&gt;
          &lt;/p:dataTable&gt;
          &lt;p:confirmDialog message="Delete client?" severity="alert" widgetVar="confirmDeleteClient" visible="false" appendToBody="true" &gt;
              &lt;p:commandButton value="Yes" update="clientList" immediate="true" oncomplete="confirmDeleteClient.hide()" actionListener="#{clientUitility.deleteRecord}" &gt;
  &lt;f:setPropertyActionListener target="#{client}" value="#{client}"
              &lt;/p:commandButton&gt;
              &lt;p:commandButton value="No" onclick="confirmDeleteClient.hide()" type="button" /&gt;
          &lt;/p:confirmDialog&gt;
          &lt;br/&gt;
  </code></pre>
  
  <p>LazyClientDataModel.java</p>
  
  <pre><code>public class LazyClientDataModel extends LazyDataModel&lt;ClientBean&gt; {
  private List&lt;ClientBean&gt; datasource;
  public LazyClientDataModel(List&lt;ClientBean&gt; datasource) {
      this.datasource = datasource;
  }
  @Override
  public ClientBean getRowData(String rowKey) {
      for(ClientBean client : datasource) {
          if(Integer.toString(client.getclientID()).equals(rowKey))
              return client;
      }
      return null;
  }
  @Override
  public Object getRowKey(ClientBean client) {
      return Integer.toString(client.getclientID());
  }
  @Override
  public List&lt;ClientBean&gt; load(int first, int pageSize, String sortField, SortOrder sortOrder, Map&lt;String,String&gt; filters) {
      List&lt;ClientBean&gt; data = new ArrayList&lt;ClientBean&gt;();
      //filter
      for(ClientBean client : datasource) {
          boolean match = true;
          for(Iterator&lt;String&gt; it = filters.keySet().iterator(); it.hasNext();) {
              try {
                  String filterProperty = it.next();
                  String filterValue = filters.get(filterProperty);
                  String fieldValue = String.valueOf(client.getClass().getField(filterProperty).get(client));
                  if(filterValue == null || fieldValue.toLowerCase().startsWith(filterValue.toLowerCase())) {
                      match = true;
                  } else {
                      match = false;
                      break;
                  }
              } catch(Exception e) {
                  match = false;
              }
          }
          if(match) {
              data.add(client);
          }
      }
      //sort
      if(sortField != null) {
          Collections.sort(data, new LazySorter(sortField, sortOrder));
      }
      //rowCount
      int dataSize = data.size();
      this.setRowCount(dataSize);
      //paginate
      if(dataSize &gt; pageSize) {
          try {
              return data.subList(first, first + pageSize);
          }
          catch(IndexOutOfBoundsException e) {
              return data.subList(first, first + (dataSize % pageSize));
          }
      }else {
          return data;
      }
  }
  }
  </code></pre>
  
  <p>clientUitility.java (managedbean)</p>
  
  <pre><code>public class ClientUitility {
  private LazyDataModel&lt;ClientBean&gt; lazyModel;
  private ClientBean client = new ClientBean();
  private List&lt;ClientBean&gt; clientAll;// = new ArrayList&lt;ClientBean&gt;();
  
  /** Creates a new instance of ClientUitility */
  public ClientUitility() {
      client = new ClientBean();
      clientAll = new ArrayList&lt;ClientBean&gt;();
      //int userID = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString());
      clientAll = ClientService.GenerateClientList(1);
      lazyModel = new LazyClientDataModel(clientAll);
  }
  // setter and getter of client 
  // getter for lazymodel
  public void deleteRecord(ActionEvent actionEvent) {
      try {
          System.out.println("Delete record Called....");
          int ClientID = client.getclientID();            
          ClientService.DeleteClient(client);
          client = new ClientBean();
          clientAll = ClientService.GenerateClientList(1);
          lazyModel = new LazyClientDataModel(clientAll);
          FacesMessage msg = new FacesMessage("Client Deleted", "");
          FacesContext.getCurrentInstance().addMessage(null, msg);
      } catch (Exception e) {
          e.printStackTrace();
      }
  public void save(ActionEvent actionEvent) {
      System.out.println("Save record Called....");
      ClientService.AddClient(client);
      client = new ClientBean();
      clientAll = ClientService.GenerateClientList(1);
      lazyModel = new LazyClientDataModel(clientAll);
      FacesMessage msg = new FacesMessage("Client Created", "");
      FacesContext.getCurrentInstance().addMessage(null, msg);
  }
  }
  </code></pre>