title: How to call method on ticking the SelectAll checkbox in p:dataTable through ajax
body: <p>I need your help in calling a method from a backing bean once I ticked the <strong>SelectAll</strong> checkbox at the top of a dataTable. I am able to call the method <strong>ShowTotal</strong>
  once I ticked or unticked the checkbox of each individual item, however when I tick the <strong>SelectAll</strong> checkbox from the top, no listener is called. Here is my code:</p>
  
  <pre><code>&lt;p:dataTable id="PendingRequests" var="hr" selection="#{hrdirector.selectedRequests}"
               value="#{hrdirector.listPendingRequests}" rowKey="#{hr.requestNo}"
               filteredValue="#{hrdirector.filteredRequests}" widgetVar="dataTableWidgetVar"&gt;
    &lt;p:ajax event="rowSelectCheckbox" listener="#{hrdirector.ShowTotal}" process="@this" 
            update=":form:PendingRequests:sum"/&gt;
  
    &lt;p:ajax event="rowUnselectCheckbox" listener="#{hrdirector.ShowTotal}" process="@this"
            update=":form:PendingRequests:sum"/&gt;
  
          &lt;p:column selectionMode="multiple" style="width:16px;text-align:center"&gt;&lt;/p:column&gt;
          &lt;p:column headerText="Request No."&gt;
              &lt;h:outputText value="#{hr.requestNo}"/&gt;
          &lt;/p:column&gt;
          &lt;p:column headerText="Request Amount"&gt;
              &lt;h:outputText value="#{hr.requestAmount}"/&gt;
          &lt;/p:column&gt;
      &lt;/p:dataTable&gt;
  
      &lt;h:outputText id="Sum" value="#{hr.Sum}"/&gt;
  </code></pre>
  
  <p>I tried to add the below code in the column which it has the selection, but it gave me an error:</p>
  
  <pre><code>&lt;p:column selectionMode="multiple" style="width:16px;text-align:center"&gt;
  &lt;p:ajax listener="#{hrdirector.ShowTotal}" /&gt;
  &lt;/p:column&gt;
  </code></pre>