Reset jquery datatables onclick function

Reset jquery datatables onclick function

inquisitive_sthainquisitive_stha Posts: 7Questions: 6Answers: 0
edited May 2018 in Free community support
$('#userDataTable').DataTable( {
                "processing": true,
                "serverSide": true,

                "ajax": {
                    "url":base_path +'/admin/data/list',
                    "dataType":"json",
                    "type":"POST",
                    "data":{"_token":csrf_token}
                },
                "columns":[
                {"data":"name"},
                {"data":"created_at"},
                {"data":"updated_at"},
                {"data":"action","searchable":false,"orderable":false}
                ]
            } );

Currently, am using this script to load data. Now, I want to reset the table while a href link is clicked. How, can I achieve this.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @inquisitive_stha ,

    You could run that same initialisation code again, but with destroy set to true, that way it'll recreate the table for you.

    Cheers,

    Colin

This discussion has been closed.