Problem with multiple state cookies for a path
Problem with multiple state cookies for a path
martintroye
Posts: 3Questions: 0Answers: 0
When I have multiple pages in the same path using a data table we are seeing state cookies get deleted when another one is updated or added.
Here is an example of what I am seeing happen in FireFox using FireBug.
For a path of /Accounts/Invoice/ there is a New, Pend and Conflict page and each uses a data table. If I go to the New page and set the number of items per page the state cookie is written as SpryMedia_DataTables_InvoiceTable_new, when I switch to the Pend page the cookie SpryMedia_DataTables_InvoiceTable_pend is written, if I switch to the Conflict page the SpryMedia_DataTables_InvoiceTable_new cookie is deleted and SpryMedia_DataTables_InvoiceTable_conflict is added.
We are using version 1.7.4, any help would be most appreciated.
Here is an example of what I am seeing happen in FireFox using FireBug.
For a path of /Accounts/Invoice/ there is a New, Pend and Conflict page and each uses a data table. If I go to the New page and set the number of items per page the state cookie is written as SpryMedia_DataTables_InvoiceTable_new, when I switch to the Pend page the cookie SpryMedia_DataTables_InvoiceTable_pend is written, if I switch to the Conflict page the SpryMedia_DataTables_InvoiceTable_new cookie is deleted and SpryMedia_DataTables_InvoiceTable_conflict is added.
We are using version 1.7.4, any help would be most appreciated.
This discussion has been closed.
Replies
[code]
var _cookieName = "Page_New_DataTable_State";
$(function () {
/*start table code*/
oTable = $('#InvoiceTable').dataTable({
"sPaginationType": "full_numbers",
"iDisplayLength": 10,
"oLanguage": {
"sLengthMenu": 'Display ' +
'10' +
'25' +
'50' +
'100' +
'Show All' +
' items'
},
"sZeroRecords": "No work items found",
"bAutoWidth": false,
"bStateSave": true,
"sCookiePrefix": _cookieName,
"fnCookieCallback": function (sName, oData, sExpires, sPath) {
var aParts = window.location.pathname.split('/');
var sCookieName = _cookieName + "InvoiceTable" + '_' + aParts[aParts.length - 1].replace(/[\/:]/g, "").toLowerCase();
return sCookieName + "=" + JSON.stringify(oData) + "; expires=" + sExpires + "; path=" + sPath;
}
});
var oSettings = oTable.fnSettings();
});
[/code]