Search code examples
jsfjsf-2primefaces

Primefaces datatable header alignment


I have a problem with primefaces datatable. As you can see there is an alignment problem with columns border and headers. Is this a primefaces bug or there is something wrong with my datatable? By the way datatable has dynamic columns. datatable

<p:dataTable     scrollable="true" scrollWidth="100%" editable="true" editMode="cell"   
var="invoiceLine" value="#{myController.invoiceLines}"                          
                         selection="#{myController.selectedInvoiceLine}" selectionMode="single" rowKey="#{invoiceLine.uuid}"
                         >
<p:columns value="#{myController.columns}" var="column"
                           styleClass="ui-editable-column" width="50"
                           columnIndexVar="colIndex">

//some stuff
</p:columns>         

            </p:dataTable>

Solution

  • Do one trick,

    Remove scrollable = true
    

    and create new style class like,

    .ui-datatable-hor-scroll .ui-datatable-tablewrapper,.scrolling-div .ui-datatable-tablewrapper{
         overflow: auto;
         width: 100%;
         padding-bottom: 5px;}
    

    apply styleClass to p:datatable like styleClass="ui-datatable-hor-scroll"