Been trying to set up a cookie for saving and returning the ColVis data. My basic code is (hand typed from intranet):
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?
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?