FixColumn adding unnecessary thead

FixColumn adding unnecessary thead

bortonjbortonj Posts: 5Questions: 1Answers: 0

my fixed columns have an unnecessary empty header being added which pushes everything down in the fixed columns.
when I look at the html in the browser I see the following (simplified):

div class="DTFC_ScrollWrapper .... 
 <pre>div class="DTFC_RightWrapper .... </pre>
 div class="dataTables_scroll ... 
 div class="DTFC_LeftWrapper ... 
       div class="DTFC_LeftHeadWrapper  ...  
            table class="table.... 
                  thead.../thead            <<< this is ok 
             /table 
       /div 
       div class="DTFC_LeftBodyWrapper. ... 
            div class="DTFC_LeftBodyLiner ... 
                 table class="table.... 
                     thead...</thead          <<<<< this shouldn't be here, it's not needed and it's empty but pushing the tbody down 
                      tbody...</tbody 
                  /table 

Anyone know why the second empty thead is being added to the DTFC_LeftBodyWrapper?

Answers

  • bortonjbortonj Posts: 5Questions: 1Answers: 0

    to temporarily correct this I've added the following after I load the data in the table:

    //BUG FIX: because of a bug with fixedcolumns need to remove the extra header
        var t2 = $(".DTFC_LeftBodyLiner thead:eq(0)")[0];
        t2.style.visibility = "hidden";
        while (t2.firstChild){
            t2.removeChild(t2.firstChild);
        }
        //END BUG FIX
    

    Yes I could probabliy just remove the thead, but for now chose this route.

  • stuartsjb-icrstuartsjb-icr Posts: 59Questions: 12Answers: 0

    I've just had this problem recently myself, are you using the sScrollX option when initialising the table?

  • bortonjbortonj Posts: 5Questions: 1Answers: 0

    yes, I've set scrollX to true.

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Can you link to the page so I can take a look, or link to a test case showing the problem please?

    Thanks,
    Allan

  • bortonjbortonj Posts: 5Questions: 1Answers: 0

    Allan, this is an internal page so I cannot do that.
    I'll see if there is a way to scale back the site to a generic table to demonstrate the problem.

  • bortonjbortonj Posts: 5Questions: 1Answers: 0

    a bit more debugging... It appears like the sort icons are causing the 'second' <thead> to show (even though the height is set to 0). The icons show in both the correct header and incorrect header. If I turn off sorting on those columns everything displays correctly. However I need to sort on the first column so I'm caught in a catch-22.
    any ideas?

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Are you using the Bootstrap integration? If so, please try the latest files from here.

    Failing that, I really would need a test case on JSFiddle, http://live.datatables.net , CodePen or similar.

    Allan

This discussion has been closed.