Datatable doesn't save state of the hidden columns

Datatable doesn't save state of the hidden columns

tejadongtejadong Posts: 7Questions: 1Answers: 0
edited July 2015 in Free community support

Hello, sorry for my English, I'm Spanish...

When I hide the columns of my table and I reload the web page It doesn't work for me however I check on the list where I can check/uncheck the columns that It works fine. It seems to be that when my web is loaded It doesn't work but the check list of column was saved.

Any suggestions?

Thanks you.

Answers

  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    Sorry, I forgot to paste my code:

    $(document).ready(function() {
                
                var table = $('table').dataTable( {
                    language: {
                        url: '{{ base_url() }}assets/json/spanish.json'
                    },
                    "dom": 'CT<"clear">lfrtip',
    
                    "tableTools": {
                    "sSwfPath": "{{ base_url() }}assets/swf/copy_csv_xls_pdf.swf",                  
                    "aButtons": [
                                 {
                                     "sExtends":     "xls",
                                     "sButtonText": "Excel"
                                 },
                                 {
                                     "sExtends":     "print",
                                     "sButtonText": "Imprimir"
                                 }                             
                                ]
                    },
                    "colVis": {
                        "buttonText": "Ocultar/Mostrar columnas",
                        "restore": "Restaurar",
                        "showAll": "Mostrar todas",
                        "showNone": "Ocultar todas"
                    },      
                    "iDisplayLength": 10,
                    "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "todos"]],
                    "stateSave": true,
                    "stateDuration": -1
                } );
                
                new $.fn.dataTable.FixedHeader( table, {
                    "offsetTop": 51
                } );                
                
            } );
    
  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    I made a test here: http://live.datatables.net/jekupuqo/1/ and work fine... I don't know...

  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    I'm using bootstrap datatable, i think It is the problem...

  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    When I use dataTables.fixedHeader and dataTables.responsive (js and css) the state of columns isn't saved... Is this a bug?

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    The issue is that you have included Responsive - which is not currently compatible with ColVis since both are trying to control column visibility.

    Allan

  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    What can i do then?

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    There is unfortunately no option to use both at the same time at the moment. You need to decide which you want more...

    It is something that I will address in a future update when I am able to do so.

    Allan

  • tejadongtejadong Posts: 7Questions: 1Answers: 0

    Ok thank you! your work is great! Cheer up!

This discussion has been closed.