Dynamic Show/Hide not hiding header columns

Dynamic Show/Hide not hiding header columns

GusGus Posts: 18Questions: 0Answers: 0
edited December 2009 in General
I am trying to implement the dynamic show/hide columns. It toggles the detail perfect, but the table headers are not hiding. I am hoping someone can point me in a good direction. have tried everything I know how to do at this point...

Thanks,
Gus

Below is a what my table header looks like.

<!--Table of Data-->




Facility
Description
Pounds Produced
Ingredients Used
Ingredients Loss
Pounds Shipped
Pounds Adjusted
Pounds Loss
Inventory Inc/Dec

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Gus,

    I don't see anything wrong with your THEAD element there, and my example ( http://datatables.net/examples/api/show_hide.html ) for fnSetColumnVis appears to be working okay. Can you post a link showing the issue?

    Regards,
    Allan
  • GusGus Posts: 18Questions: 0Answers: 0
    Please disregard this post. I found the issue.
    I was also using FixedHeader and that was causing this issue....

    Thanks
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Gus,

    Ah! What you need to do, if you are using FixedHeader, is when you call fnSetColumnVis, is just make a call to 'fnUpdate' on the FixedHeader object. That will update it for your newly hidden column :-)

    Regards,
    Allan
  • GusGus Posts: 18Questions: 0Answers: 0
    Hi Allan,
    Sorry for the lack of understanding(not really a programmer), I have tried to do what you said to no avail.

    So, I would do the fnUpdate call say here?:

    function fnShowHide( iCol )
    {
    var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
    oTable.fnSetColumnVis( iCol, bVis ? false : true );
    //fnUpdate(oTable,aoData[iIndex],aoColumns[iCol],false); //??
    };


    Thanks for the help,

    Gus
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Gus,

    Yes that's basically correct. Although you need to call fnupdate on the FixedHeader object. $.fn.dataTableExt.FixedHeader.fnUpdate() should do it.

    Regards,
    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    I should have noted in fact that this is fnUpdate in FixedHeader, and not the DataTables fnUpdate() - which I've just realised your syntax is leaning towards... :-)

    Regards,
    Allan
This discussion has been closed.