title: p:commandButton in p:dataTable
body: <p>I got a problem with a p:commandButton inside a p:dataTable
  My button does not call the procedure in my backing bean.
  Does anyone have an idea why this button won't work?</p>
  
  <p>Best Regards</p>
  
  <p>Button Code:</p>
  
  <pre><code> &lt;p:column headerText="Details" style="width: 10px;"&gt;
                              &lt;p:outputPanel id="buttonDetail"&gt;
                                  &lt;p:commandButton icon="ui-icon-vwfList" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.selectHistoryElement()}"
                                                  id="buttonDetail"                                           
                                                  update=":historyDetail"
                                                  title="GO!!!"&gt;
                                  &lt;/p:commandButton&gt;
                              &lt;/p:outputPanel&gt;
                          &lt;/p:column&gt;
  </code></pre>
  
  <p>Full Code of JSF-Page:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:m="http://java.sun.com/jsf/composite/components/mmnet"&gt;
  
          &lt;h:form id="historyList"&gt;
  
  
                  &lt;p:dataTable id="historyTable"
                              value="#{customerChangeHistoryListHandler.dataModel}"
                              var="_history"
                              lazy="true"
                              paginator="true" 
                              rows="20"
                              paginatorAlwaysVisible="false"
                              paginatorPosition="bottom" 
                              rowsPerPageTemplate="5,10,15,20,25,50"
                              paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                              selectionMode="single"
                              selection="#{customerChangeHistoryHandler.entity}"
                              style="margin-top:5px;"&gt;
  
  
                  &lt;f:facet name="header"&gt;
                      &lt;h:outputText   value="#{labels.historie} (#{customerChangeHistoryListHandler.dataModel.rowCount})"/&gt;
                  &lt;/f:facet&gt;
  
                      &lt;p:ajax event="rowSelect" listener="#{customerChangeHistoryHandler.onRowSelect}" update=":contentPanel"/&gt;
  
                          &lt;p:column headerText="#{labels.typ}"
                              style="width: 10px;"&gt;
                              &lt;p:outputPanel id="buttonImage"&gt;
                                  &lt;p:commandButton icon="ui-icon-workflow" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.onRowSelect}"
                                                  update=":contentPanel" 
                                                  rendered="#{_history.changeType == 'WORKFLOW_CHANGED' or _history.changeType == 'WORKFLOW_CREATED' or _history.changeType == 'WORKFLOW_DELETED'}"&gt;
                                  &lt;/p:commandButton&gt;
                                  &lt;p:commandButton icon="ui-icon-note" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.onRowSelect}"
                                                  update=":contentPanel" 
                                                  rendered="#{_history.changeType == 'NOTE_CHANGED' or _history.changeType == 'NOTE_CREATED' or _history.changeType == 'NOTE_DELETED'}"&gt;
                                  &lt;/p:commandButton&gt;
                                  &lt;p:commandButton icon="ui-icon-diso" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.onRowSelect}"
                                                  update=":contentPanel" 
                                                  rendered="#{_history.changeType == 'ERP_CHANGE'}"&gt;
                                  &lt;/p:commandButton&gt;
                                  &lt;p:commandButton icon="ui-icon-info" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.onRowSelect}"
                                                  update=":contentPanel" 
                                                  rendered="#{_history.changeType == 'CUSTOMER_MERGED'}"&gt;
                                  &lt;/p:commandButton&gt;
                                  &lt;p:commandButton icon="ui-icon-arrowthickstop-1-s" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.onRowSelect}"
                                                  update=":contentPanel" 
                                                  rendered="#{_history.changeType == 'FILE_UPLOADED'}"&gt;
                                  &lt;/p:commandButton&gt;
                              &lt;/p:outputPanel&gt;
                          &lt;/p:column&gt;
  
                          &lt;p:column headerText="Details" style="width: 10px;"&gt;
                              &lt;p:outputPanel id="buttonDetail"&gt;
                                  &lt;p:commandButton icon="ui-icon-vwfList" 
                                                  styleClass="colButton" 
                                                  action="#{customerChangeHistoryHandler.selectHistoryElement()}"
                                                  id="buttonDetail"                                           
                                                  update=":historyDetail"
                                                  title="GO!!!"&gt;
                                  &lt;/p:commandButton&gt;
                              &lt;/p:outputPanel&gt;
                          &lt;/p:column&gt;
  
                          &lt;p:column headerText="ChangeType"
                                      sortBy="#{_history.changeType}"&gt;
                              &lt;h:outputText value="#{labels[_history.changeType]}" /&gt;
                          &lt;/p:column&gt;
  
                          &lt;p:column headerText="#{labels.beschreibung}"&gt;
                              &lt;h:outputText value="#{_history.description}" /&gt;
                          &lt;/p:column&gt;
  
                          &lt;p:column headerText="#{labels.modDate} und #{labels.modUser}"
                                  sortBy="#{_history.modDate}"&gt;
                              &lt;m:outputDateUser valueDate="#{_history.modDate}" valueUser="#{_history.modUser}" /&gt;
                          &lt;/p:column&gt;
  
                  &lt;/p:dataTable&gt;
  
          &lt;/h:form&gt;
  
          &lt;h:form id="historyDetail"&gt;
  
                  &lt;p:panel id="detailPanel" rendered="#{customerChangeHistoryHandler.entity != null}"&gt;
                  History Detail --&gt; ToDo
                  &lt;/p:panel&gt;  
  
          &lt;/h:form&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>Backing Bean:</p>
  
  <pre><code>import javax.inject.Inject;
  import javax.inject.Named;
  
  import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessScoped;
  import org.primefaces.event.SelectEvent;
  
  @Named
  @ViewAccessScoped
  public class CustomerChangeHistoryHandler extends JccPersistenceHandler&lt;Integer, CustomerChangeHistory&gt;{
  
      @Inject
      NewsMessageHandler newsMessageHandler;
  
      @Inject
      DebitorenakteState debitorenakteState;
  
      @Inject
      private WorkflowHandler workflowHandler;
  
  
      @Override
      protected Class&lt;CustomerChangeHistory&gt; getEntityType() {
          return CustomerChangeHistory.class;
      }
  
      @Override
      public CustomerChangeHistory getEntity() {
          return super.getEntity();
      }
  
      @Override
      public void onRowSelect(SelectEvent event) {
          Integer tmpId = this.entity.getLinkedId();
          try {
              ChangeType tmpChangeType = this.entity.getChangeType(); 
              if(tmpChangeType.equals(CustomerChangeHistory.ChangeType.WORKFLOW_CHANGED) || tmpChangeType.equals(CustomerChangeHistory.ChangeType.WORKFLOW_CREATED) || tmpChangeType.equals(CustomerChangeHistory.ChangeType.WORKFLOW_DELETED)){
                  workflowHandler.setSelectionId(tmpId);
                  workflowHandler.selectById();
                  workflowHandler.select();
              } else if(tmpChangeType.equals(CustomerChangeHistory.ChangeType.NOTE_CHANGED) || tmpChangeType.equals(CustomerChangeHistory.ChangeType.NOTE_CREATED) || tmpChangeType.equals(CustomerChangeHistory.ChangeType.NOTE_DELETED)){
                  newsMessageHandler.setSelectionId(tmpId);
                  newsMessageHandler.selectById();
                  newsMessageHandler.onRowSelect(event);
                  debitorenakteState.setActivePage(DebitorenakteEnvironment.PAGE_MORE_NOTES);
                  debitorenakteState.setActiveTabIndex(6);
              } else if(tmpChangeType.equals(CustomerChangeHistory.ChangeType.ERP_CHANGE)){
  
                  //TODO
  
              } else if(tmpChangeType.equals(CustomerChangeHistory.ChangeType.CUSTOMER_MERGED)){
  
                  //TODO
  
              } else if(tmpChangeType.equals(CustomerChangeHistory.ChangeType.FILE_UPLOADED)){
  
                  //TODO
  
              } else {
                  logError("ChangeType nicht gefunden: " + this.entity.getChangeType().toString());
              }
              super.onRowSelect(event);
          } catch (Exception e) {
              // TODO: handle exception
              jsfMessageService.info("Eintrag nicht mehr vorhanden", event);
          }   
      }
  
      public void selectHistoryElement(){
          System.out.println("&lt;-------------------------YEA, Button pressed!!! ---------------------------------&gt;");
  //      logDebug("Showing History Entity: " + this.entity);
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Is there a way to let the bean for the data model RequestScoped?</p>