DataTables: When scroll bar of tbody is hidden, fixed column gets messed up
I've got a table which includes:
- first Column is fixed
- tfoot
- horizontal scroll bar of tfoot
- have hidden horizontal scroll bar of tbody.
Fiddle:
https://jsfiddle.net/jbeteta/6sxh3gbk/12/
- $(function() {
- $('#example').DataTable({
- "fnInitComplete": function () {
- // Disable scrolling in Head
- $('.dataTables_scrollHead').css({
- 'overflow-y': 'hidden !important'
- });
- // Disable TBODY scroll bars
- $('.dataTables_scrollBody').css({
- 'overflow-y': 'scroll',
- 'overflow-x': 'hidden',
- 'border': 'none'
- });
- // Enable TFOOT scoll bars
- $('.dataTables_scrollFoot').css('overflow', 'auto');
- // Sync TFOOT scrolling with TBODY
- $('.dataTables_scrollFoot').on('scroll', function () {
- $('.dataTables_scrollBody').scrollLeft($(this).scrollLeft());
- });
- },
- scrollX: true,
- paging: true,
- fixedColumns: {
- leftColumns: 1
- }
- });
- });
In that scenario, when you scroll to the right side, you will see that last row cell of fixed Column (background color: red) get messed up, because horizontal <tbody>
scroll bar is hidden.
My question: Is there any way to correct this?
By the way: I had to hide <tbody>
horizontal scroll bar because it doesn't get syncronized with <tfoot>
scroll bar.
Many thanks