Hidden columns are shown when browser window is resized

Hidden columns are shown when browser window is resized

cbusuttilcbusuttil Posts: 4Questions: 1Answers: 0

Hi Guys,

I'm encountering an issue with datatables having hidden columns. I'm using the function fnSetColumnVis to hide a column and it works perfectly, however when the browser window is being resized the hidden columns are being shown again. Can someone point me in the right direction please?

Best Regards,

Chris.

This question has an accepted answers - jump to answer

Answers

  • neurofunkneurofunk Posts: 14Questions: 5Answers: 1
    edited July 2015
    var dt = $('#example').DataTable( {
        "columns": [
            {
                "data":          'id' ,
                "visible":      false   //   <<--
            }
        ],
    )};
    

    I never had problems with this code.

  • cbusuttilcbusuttil Posts: 4Questions: 1Answers: 0

    Hi neurofunk,

    thanks for your reply. i'm actually using aoColumns, i tried using the bVisible: false option, however it wasn't working that's why i had to use fnSetColumnVis.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Sounds very much like you are using Responsive (although without a test case, as required by the forum rules, it is impossible to say for sure).

    At the moment Responsive and column visibility are not compatible since Responsive itself is using the column visibility controls.

    This is something I will be addressing in a future release of Responsive.

    If you want columns to never be shown, use the none or never class - see documentation.

    Allan

  • cbusuttilcbusuttil Posts: 4Questions: 1Answers: 0

    Hi allan,

    Many thanks for your feedback. You are right i'm using the Responsive, in fact i thought that it might be the cause of the issue. I'll take a look at the documentation you gave me and will let you know how it goes.

    Chris.

  • cbusuttilcbusuttil Posts: 4Questions: 1Answers: 0

    Hi allan

    Thanks a lot for your help, using the class never worked like a charm. Thanks once again.

    Best Regards,

    Chris.

This discussion has been closed.