title: Primefaces Datatable header width:auto
body: <p>I am developing a dynamic Datatable with Primefaces 5. I have set the table width to auto. This is really nice. My Column uses only the needed width, which is perfect. But I also use paginator and a Table header. So my table looks like this:
  <img src="https://i.stack.imgur.com/4uM1D.png" alt="Dynamic datatable with header"></p>
  
  <pre><code>&lt;p:dataTable var="row"  
               editingRow="#{row.status == CommonConstant.ROWSTATUS_EDIT}" 
               tableStyle="width:auto"
               value="#{componentBean.componentData[componentId].lazyModel}"
               id="#{componentId}" 
               editable="true" scrollable="false" scrollHeight="100%"
               resizableColumns="true"
               paginator="true"
               paginatorPosition="top"
               rowsPerPageTemplate="10 25 50 100"
               lazy="true"&gt;
    &lt;f:facet name="header"&gt;   
      &lt;p:outputPanel style="text-align:right"&gt;  
        &lt;h:commandLink rendered="#{fn:indexOf(componentBean.componentData[componentId].loadedData.actions, CommonConstant.ACTIONTYPE_EXCEL) &gt;= 0}" &gt;
          &lt;img border="0" src="img/excel.png" width="24"/&gt;
          &lt;p:dataExporter type="xls" target="#{componentId}" fileName="#{appDialogId}" /&gt;
        &lt;/h:commandLink&gt;
  
        &lt;h:commandLink rendered="#{fn:indexOf(componentBean.componentData[componentId].loadedData.actions, CommonConstant.ACTIONTYPE_PDF) &gt;= 0}"&gt;
          &lt;img border="0" src="img/pdf.png" width="24"/&gt;
          &lt;p:dataExporter type="pdf" target="#{componentId}" fileName="#{appDialogId}"/&gt;
        &lt;/h:commandLink&gt;
  
      &lt;/p:outputPanel&gt;    
  
      &lt;p:outputPanel&gt;
        &lt;h:outputText value="#{componentBean.componentData[componentId].loadedData.appdialogid}" /&gt;
      &lt;/p:outputPanel&gt;                                              
    &lt;/f:facet&gt;
  ...
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>How can I force the Header and the paginator to have the same width than the table?</p>