Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81689

ColVis with jquery cookie?

$
0
0
Been trying to set up a cookie for saving and returning the ColVis data. My basic code is (hand typed from intranet):
var columnDisplayIndex = $.cookie("columnIndexCookie");
$("#datatable).ready(function(){
    $("#datatable).dataTable({
     ......
     "aoColumnDefs" : [{
               "bVisible" : false, "aTargets" : [columnDisplayIndex]
     }]
     .......
     "fnDrawCallback" :
          function(oSettings){
                   var vCols = new Array();
                   .each($("#openTable").dataTable().fnSettings().aoColumns, function(c){
                           if(oSettings.aoColumns[c].bVisible == false){
                                  vCols.push(c);
                            }
                    });
                    $.cookie("columnIndexCookie", vCols, {expires:90})
        .....

I can return the values (print out in the firebug console logs) when I click the ColVis buttons and I can see the values in the cookie. I can return the values from the var in the cookie (var columnDisplayIndex ) but it doesn't seem to read it on refresh or load when it gets to the aoColumnDefs.

Any ideas what i'm missing here?

Viewing all articles
Browse latest Browse all 81689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>