Header Alignment mismatch with scrollX = true

Header Alignment mismatch with scrollX = true

alzamboalzambo Posts: 38Questions: 17Answers: 1

Hi,
I have a column headers misalignment issue, appearing when enabling scrollX.
See Image

This is HTML:

<table id="tabellaDati" class="table table-bordered table-hover" >
    <thead>
    <tr>
        <th>Azioni</th>
        <th class="stato">&nbsp;</th>
        <th class="stato">&nbsp;</th>
        <th>Protocollo</th>
        <th>Data Incarico</th>
        <th>Assicurato</th>
        <th>Sinistro</th>
        <th>Evento</th>
        <th>Compagnia</th>
        <th>Data Sinistro</th>
        <th>Data Sopralluogo</th>
        <th>Stato Pratica</th>
        <th>Incaricato</th>
        <th>Data Scadenza</th>
        <th>Casa</th>
        <th>GG</th>
    </tr>
    </thead>
</table>

This is JS:

"lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "Tutti"] ],
"stateSave": true,
"autoWidth": false,
 "scrollX": "100%",

Is it a known issue or maybe something wrong with my css?
Thank you

Answers

  • allanallan Posts: 61,657Questions: 1Answers: 10,094 Site admin

    I would suggest you keep autoWidth enabled. Also check that you are using the latest version of DataTables.

    Failing that, please link to a page showing the issue.

    Allan

  • alzamboalzambo Posts: 38Questions: 17Answers: 1

    Hi Allan,
    no luck autoWidth enabled.
    I've also checked DT version and it's 1.10.11.

    This is the page

  • allanallan Posts: 61,657Questions: 1Answers: 10,094 Site admin

    You have the following in your CSS - could you remove it please:

    div.dataTables_scrollBody table {
        table-layout: fixed;
        width: 98% !important;
    }
    

    Allan

  • alzamboalzambo Posts: 38Questions: 17Answers: 1
    edited February 2016

    Ok, i've commented it out...
    but the problem remains...

  • alzamboalzambo Posts: 38Questions: 17Answers: 1

    ...up...

  • allanallan Posts: 61,657Questions: 1Answers: 10,094 Site admin

    Could you also add width="100%" as an attribute to your HTML table please?

    Allan

  • alzamboalzambo Posts: 38Questions: 17Answers: 1

    Ok, done.
    Same problem...

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Try the options I gave in my answer to the question in this thread https://datatables.net/forums/discussion/comment/88457/#Comment_88457 .

    Allan has already had you do some of these.

  • alzamboalzambo Posts: 38Questions: 17Answers: 1
    edited February 2016

    @jr42.gordon
    Tried everyting in your post but without luck!

    Thank you..

  • allanallan Posts: 61,657Questions: 1Answers: 10,094 Site admin

    "autoWidth": false,

    Can you remove that please.

    Allan

This discussion has been closed.