SpryMedia_DataTables_datalist_25 cookie

SpryMedia_DataTables_datalist_25 cookie

WebDevWebDev Posts: 21Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Okay, I am setting cookies by including:

[code]"bStateSave": true[/code]

But the problem is that it is proliferating a whole bunch of such cookies, each with a different number at the end, when I only want one such cookie. Is there a way to restrict it to just a "SpryMedia_DataTables_datalist" cookie? This is very important to our project and may help clear up the pagination issue I brought up in another thread.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Currently no - there is no internal way of sharing cookies between multiple tables. You'd need to override the state saving method with your own method (I'd recommend localStorage) or modify how DataTables works.

    Allan
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    edited November 2012
    Well, I'm not trying to share cookies between multiple tables. I am trying to make sure the one and only Data Table on the site only has one cookie and I can't understand why it's making a whole bunch of different ones.

    The problem is that since there is more than one then the Data Table never knows which page to start displaying from when the user goes to a new page.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please link us to a test case showing the issue, as I'm not sure what the problem is.

    Do your tables have ids?

    Allan
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    edited November 2012
    Here's the example:

    http://cmzmedia.com/datatabletest/

    Now, say from here you advance through all the pages of the DataTable until you get to the last one which shows rows 51 - 57. Then after that you click on the link that says "Go To Next Page." When the user clicks on that and goes to nextpage.html I want the DataTable to then be displaying its last page (rows 51 - 57). In my project, sometimes it actually works (leading me to believe that a solution is not impossible) but usually it doesn't and I think it's because instead of there only being one cookie there are inexplicably a whole bunch. They each start with "SpryMedia_DataTables_datalist_" and then end with some two or three digit number.

    And, yes, the ID for this table is "datalist."
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    UPDATE: This seems to be working better now that I've implemented the local storage aspect. The question that remains is if the company is fine with that solution (not your concern). But I can still really use help with my repaginating issue:

    http://datatables.net/forums/discussion/12830/keep-datatable-but-repaginate-after-repopulating-datatable#Item_3
This discussion has been closed.