How can I tell if statesave page no longer exists?

How can I tell if statesave page no longer exists?

kvothekvothe Posts: 2Questions: 1Answers: 0
edited June 2016 in Free community support

My table:

    var dataTables=$('.pagedTable').DataTable({
        "processing": true
            ,"serverSide": true
            ,"stateSave":true
            ,"stateDuration": 60 * 60 * 24
        ,"ajax": {
                "url":url
                ,"type":"post"
            }
        ,"columns":[
                     {"data":"id","defaultContent":"0"}, etc

My code to clear state:

    if(page doesn't exist){
          dataTables.state.clear();
          dataTables.draw()
    }

I don't know how to tell if the page doesn't exist. I've tried dataTables.page.info() but the data it shows is the same whether my page has data or not.

Answers

  • kvothekvothe Posts: 2Questions: 1Answers: 0
    edited June 2016

    After SO MUCH trial and error, I finally succeeded with this code:

    ,"fnDrawCallback":function(){
        if(dataTables.row().data()===undefined){
            dataTables.state.clear();
            location.href=url
        }
    }
    
This discussion has been closed.