LocalStorage and multiple tables.

LocalStorage and multiple tables.

jhartzelljhartzell Posts: 3Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Hello!

I'd like to say thank you so much for such a great API. This has blown my mind for a free project and surpasses so many expectations!

I switched our application over from using cookies to local storage. This was a seamlessly painful switch however I'm having a small problem.

I have two tables on a page that looks like this
[code]

$('#mytickets').dataTable({
"sDom": 'CR<"clear">lfrtip',
"sPaginationType": "full_numbers",
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
localStorage.setItem('MyTickets', JSON.stringify(oData));
},
"fnStateLoad": function (oSettings) {
return JSON.parse(localStorage.getItem('MyTickets'));
}
});

$('#unclaimedtickets').dataTable({
"sDom": 'CR<"clear">lfrtip',
"sPaginationType": "full_numbers",
"bStateSave": true,
"fnStateSave": function (oSettings, oData) {
localStorage.setItem('UnclaimedTickets', JSON.stringify(oData));
},
"fnStateLoad": function (oSettings) {
return JSON.parse(localStorage.getItem('UnclaimedTickets'));
}
});

[/code]

This works great on my index page and whenever anything state related between these two tables changes it changes the appropriate localStorage key.

Howevever, when I go to my other page "Open Tickets" which has 1 datatable in the middle of a blank page it never creates a localstorage key. Is there a limit to where you can only have two localstorage values?

Any help would be appreciated! Please let me know if you need further information!

Replies

This discussion has been closed.