Separation between head and body

Separation between head and body

DavidBL78DavidBL78 Posts: 4Questions: 1Answers: 0

Why are head and body separated into two tables after calling datatables(). We do not expect such a layout when we first put all together in one table.

I know the topic about non-aligned head with body columns has been discussed many times and several solutions have been proposed, but none is satisfying. In the project i work on, for a big company, the problem repeats in different ways. I can fix the issue with fnDraw() somewhere in the project but in another view a datatable won't be fixed this way.

Does any definitive fix exist for all situations ?

The project uses DataTables 1.10.5 and cannot be upgraded.

I've tried fixing CSS, drawCallback, fnDraw(), nothing works.

Thanks for your help, i'm stuck.

David

Replies

  • allanallan Posts: 63,015Questions: 1Answers: 10,374 Site admin

    Hi David,

    Why are head and body separated into two tables after calling datatables().

    This only happens if you have scrolling enabled in the table. It is required to make the table body scroll in a cross browser manner (i.e. there needs to be a container for the body that scrolls).

    There have been a lot of fixes in this area since 1.10.5 (improved calculations), so if it is at all possible to update, I would strongly encourage you to do so.

    The alternative is not to enable scrolling, which means the table won't be broken up.

    Allan

  • DavidBL78DavidBL78 Posts: 4Questions: 1Answers: 0

    Hi Allan,

    Thanks for fast answer, this helps me to go forward.

    Regards,

    David

  • DavidBL78DavidBL78 Posts: 4Questions: 1Answers: 0

    For your information, the problem was solved by renewing DataTables CSS with the official version. The version in the project was modified and a bit old.

    David

  • allanallan Posts: 63,015Questions: 1Answers: 10,374 Site admin

    Good to hear that the latest code works for you :-)

    Allan

This discussion has been closed.