/** * Save the state of a table in a cookie such that the page can be reloaded * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnSaveState ( oSettings ) { if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying ) { return; } /* Store the interesting variables */ var i, iLen, bInfinite=oSettings.oScroll.bInfinite; var oState = { "iCreate": new Date().getTime(), "iStart": (bInfinite ? 0 : oSettings._iDisplayStart), "iEnd": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd), "iLength": oSettings._iDisplayLength, "aaSorting": $.extend( true, [], oSettings.aaSorting ), "oSearch": $.extend( true, {}, oSettings.oPreviousSearch ), "aoSearchCols": $.extend( true, [], oSettings.aoPreSearchCols ), "abVisCols": [] }; for ( i=0, iLen=oSettings.aoColumns.length ; i 4096 ) /* Magic 10 for padding */ { for ( var i=0, iLen=aCookies.length ; i 4096 ) { if ( aOldCookies.length === 0 ) { // Deleted all DT cookies and still not enough space. Can't state save return; } var old = aOldCookies.pop(); document.cookie = old.name+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+ aParts.join('/') + "/"; } } document.cookie = sFullCookie; } /** * Read an old cookie to get a cookie with an old table state * @param {string} sName name of the cookie to read * @returns {string} contents of the cookie - or null if no cookie with that name found * @memberof DataTable#oApi */ function _fnReadCookie ( sName ) { var aParts = window.location.pathname.split('/'), sNameEQ = sName + '_' + aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase() + '=', sCookieContents = document.cookie.split(';'); for( var i=0 ; i