Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35380

DataTables.NET Paging Counts Incorrect when using Server Side Data

$
0
0

I have a jQuery DataTables (v 1.10.4) table configured like this:

$('#example').dataTable({
                "serverSide": true,
                "order": [0, "asc"],
                "ajax": { url: "/api/users?type=all", dataSrc: "users" },
                "columns": [
                    { "data": "Name" },
                    { "data": "Dob" },
                    { "data": "Gender" }
                ]
            });
        });

My server returns the following from the Ajax call (not valid JSON, just copied from Chrome):

    draw: 1
    users: [{Id: "5b54b4a0-d1ad-4f0b-80a4-5fff6d6a74af", Name: "DOE, JOHN", Dob: "19371127", Gender: "M",…},…]
    recordsFilter: 287
    recordsTotal: 287

This includes the required return fields as described in the DataTables.NET documentation, but for some reason the paging numbers render incorrectly:

enter image description here

The rest of the table renders and functions just fine, aside from the "Prev..." and "Next..." buttons being disabled (I assume because it thinks there are 0 results). Has anyone encountered this issue before?

(also on StackOverflow)


Viewing all articles
Browse latest Browse all 35380