modified cookiename is not used while retrieving saved state

modified cookiename is not used while retrieving saved state

tapsboytapsboy Posts: 11Questions: 0Answers: 0
edited December 2011 in General
Issue # 1:
I have multiple datatables on a single page. I refer to each one by a unique sGridName

[code]

'fnCookieCallback': function(sName, oData, sExpires, sPath){
sName = 'my_DataTables_' + sGridName;
return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
},
[/code]

After I load the page for the first time, it create a cookie as per my naming convention, but when I refresh the page , none of properties from the saved state is retrieved.

So, I wrote my_DataTables as a sCookiePrefix and then removed the line assigning a new name to sName as below. It works fine.

[code]

'fnCookieCallback': function(sName, oData, sExpires, sPath){
return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
},
[/code]

But that leads me to another issue, which even happens if I leave cookie handling to default implementation. That problem is this:

Issue # 2:

On Codeigniter framework I may can access a page containing datatables as

http://localhost/users
http://localhost/users/
http://localhost/users/index

It loads the same page each time, but create 3 different cookies

my_DataTable_users-grid_users
my_DataTable_users-grid_
my_DataTable_users-grid_index

respectively.

And thus the state is not retrieved.

Moreover, I would also want to use the same grid on a totally different page, let's say (http://localhost/manage/someusers) and make the saved state available on that page too.


Has anyone dealt with this before or can suggest a solution?

Replies

  • tapsboytapsboy Posts: 11Questions: 0Answers: 0
    edited December 2011
    Discussion continued here:
    http://www.datatables.net/forums/discussion/202/can-i-specify-cookie-name-for-state-saving
This discussion has been closed.