Search code examples
jquerydatatablesserver-side

Jquery Datatables Pagination Not Updating


I'm returning this json to my datatable and it adds the data to the table but the entries are 0 to 0 out of 0. I'm not sure if it's an error on my part or a bug with their plugin but based on their documentation it looks right.

https://datatables.net/manual/server-side

Pic of the table http://tinypic.com/r/2vdqjxz/8

Javascript

 $('#query-results-table').dataTable({
            "processing": true,
            "serverSide": true,
            "ajax": webroot + "AdminQueryBuilder/PreviewQueryResultProcessing?QueryID=" + queryID
    });

C# Model

public class ReturnedDataTableParameter
    {
        public int draw { get; set; }

        public int recordsTotal { get; set; }

        public int recordsFiltered { get; set; }

        public List<List<string>> data { get; set; }

    }

JSON:

{
"draw": 1,
"recordsTotal": 200,
"recordsFiltered": 200,
"data": [
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
],
[
"1",
"Y",
"RS14:35"
]
]
}

Solution

  • I actually figured the problem out. The Datatable was being re-declared later down the page on the same element which was resulting in this weird issue.