title: Primefaces dataTable rowEditor
body: <p>I'm using Primefaces' <code>p:dataTable</code> to display an editable table. Is there any way to detect when the <code>p:rowEditor</code> icon has been clicked? I need this because i want to disable, when in editing mode, a <code>p:commandLink</code> that i've added for row deletion.</p>
  
  <p>And here's the .xhtml:</p>
  
  <pre><code>&lt;p:dataTable paginatorAlwaysVisible="true"
                   paginator="true"
                   paginatorPosition="top"
                   paginatorTemplate="{CurrentPageReport} {PageLinks} {RowsPerPageDropdown}"
                   rowsPerPageTemplate="10,25,50"
                   rows="10"
                   editable="true"
                   value="#{userController.allUsers}"
                   var="user"
                   &gt; 
          &lt;p:ajax event="rowEdit" listener="#{userController.onEdit}"/&gt;
          &lt;p:column headerText="First Name"&gt;
              &lt;p:cellEditor&gt;
                  &lt;f:facet name="output"&gt;
                      &lt;h:outputText value="#{user.firstname}"/&gt;
                  &lt;/f:facet&gt;
                  &lt;f:facet name="input"&gt;
                      &lt;h:inputText value="#{user.firstname}"/&gt;
                  &lt;/f:facet&gt;
              &lt;/p:cellEditor&gt;
          &lt;/p:column&gt;
  
          //. . . some other data columns
  
          &lt;p:column headerText="Options"&gt;
              &lt;p:rowEditor/&gt; &lt;br/&gt;
              &lt;p:commandLink id="deleteLink" styleClass="ui-icon ui-icon-trash"  action="#{userController.deleteUser(user.userId)}"/&gt;
          &lt;/p:column&gt;
  </code></pre>
  
  <p>And here the parts of the bean i find relevant: </p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class UserController {
      @EJB
      private UserBean userBean;
      @EJB
      private TeamBean teamBean;
      private Integer currentUserId;
      private String newUserUsername;
      private String newUserPassword;
      private User.AccountType newUserAccountType;
      private String newUserFirstName;
      private String newUserLastName;
      private Integer newUserTeamId;
  
      // ... some create/ update/ delete functions that work
  
      public void onEdit(RowEditEvent event) {
          try {
              User user = (User) event.getObject();
              System.out.println("Edit: " + user);
  
              userBean.update(user.getUserId(), user.getUsername(), user.getPassword(), 
                  User.AccountType.valueOf(user.getAccountType()), user.getFirstname(), user.getLastname(),
                  user.getTeam() == null ? null : user.getTeam().getTeamId());
              System.out.println("User " + user.getUserId() + " updated: " + user.getFirstname());
      } catch (InexistentUserException ex) {
          Logger.getLogger(UserController.class.getName()).log(Level.SEVERE, null, ex);
      } catch (InvalidUsernameException ex) {
          Logger.getLogger(UserController.class.getName()).log(Level.SEVERE, null, ex);
      } catch (InexistentTeamException ex) {
          Logger.getLogger(UserController.class.getName()).log(Level.SEVERE, null, ex);
      } catch (DataBaseException ex) {
          Logger.getLogger(UserController.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  
  }
  </code></pre>
  
  <p>Thanks!</p>