Vertical Scroll Header not aligned

Vertical Scroll Header not aligned

dfauncedfaunce Posts: 5Questions: 2Answers: 0
edited June 2017 in Free community support

I've setup my table similar to this: https://datatables.net/examples/basic_init/scroll_y.html

The feature works, but the column headers are not aligned with the body of the data.

I've attached a screen shot of what it looks like.

What am I doing wrong??

My jQuery:

 $(".datatable").DataTable({
                "scrollY": "400px",
                "scrollX": true,
                "scrollCollapse": true,
                "paging": false,
                buttons: {
                    buttons: [
                        {
                            extend: 'excelHtml5',
                            className: 'btn btn-light-green',
                            //title: 'Control Relays',
                            text: '<i class="icon-file-spreadsheet position-left"></i> Excel',
                            exportOptions: {
                                columns: ":not(.no-export)"
                            }
                        },
                        {
                            extend: 'pdfHtml5',
                            className: 'btn btn-light-red',
                            text: '<i class="icon-file-pdf position-left"></i> PDF',
                            orientation: 'landscape',
                            exportOptions: {
                                columns: ":not(.no-export)"
                            }
                        },
                        {
                            extend: 'colvis',
                            text: '<i class="icon-three-bars"></i> <span class="caret"></span>',
                            className: 'btn btn-charcoal btn-icon'
                        }
                    ]
                }
            });

Answers

  • dfauncedfaunce Posts: 5Questions: 2Answers: 0

    Image

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    Do you have width="100%" set on your table?

    Kevin

  • dfauncedfaunce Posts: 5Questions: 2Answers: 0

    I hadn't, it was set to 1500px, but I just set it to 100% and it still shows up misaligned.

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    Looks like you are using jqueryui possibly?

    I wonder if there is a CSS conflict causing the problem. Can you build a test case showing the issue?

    Kevin

  • dfauncedfaunce Posts: 5Questions: 2Answers: 0

    I think you are right. I am using a pre-made HTML template and it seems like the author combined his bootstrap css with other libraries to form one giant hybrid css file. Let me see if I can create this case with his hybrid file.

  • deltadelta Posts: 1Questions: 0Answers: 0

    Add flow style

    .dataTables_scrollHeadInner {
    width: 100% !important;
    }
    .dataTables_scrollHeadInner table {
    width: 100% !important;
    }

This discussion has been closed.