DataTables fixed headers misaligned with columns in wide tables

前端 未结 21 1583
悲&欢浪女
悲&欢浪女 2020-11-30 19:23

Problem

When using the sScrollX, sScrollXInner and/or sScrollY to achieve a fixed header table with its inner content scroll

相关标签:
21条回答
  • 2020-11-30 20:23

    If you want to use scrollY use:

    $('.DataTables_sort_wrapper').trigger("click");

    0 讨论(0)
  • 2020-11-30 20:25

    Trigger DataTable search function after initializing DataTable with a blank string in it. It will automatically adjust misalignment of thead with tbody.

    $( document ).ready(function()
    {
    
        $('#monitor_data_voyage').DataTable( {
            scrollY:150,
            bSort:false,
            bPaginate:false,
            sScrollX: "100%",
            scrollX: true,
        } );
    
        setTimeout( function(){
           $('#monitor_data_voyage').DataTable().search( '' ).draw();
        }, 10 );
    
    });
    
    0 讨论(0)
  • 2020-11-30 20:27

    I have fixed the column issue bu using below concept

    $(".panel-title a").click(function(){
        setTimeout( function(){
               $('#tblSValidationFilerGrid').DataTable().search( '' ).draw();
            }, 10 );
    })
    
    0 讨论(0)
提交回复
热议问题