cannot read property length of undefined with ajax and datatables 1.10
cannot read property length of undefined with ajax and datatables 1.10
ArunRahul
Posts: 16Questions: 4Answers: 0
I am having the following table structure
userTable = $("#users").DataTable({
paging : true, // activates pagination
info : true,
lengthChange : true,
searching : true,
serverSide : true,
ajax : "/Myapp/app/userManipulation/getUsers",
"columns": [
{ data: "username" },
{ data: "password" },
{ data: "role" },
{ data: "status" },
],
"language": {
"emptyTable": "Nothing found yet"
}
});
The ajax call returns a list a json response which is a list of objects. I am using spring mvc which returns List<MyObject>.
I am getting "Cannot read property 'length' of undefined"
This discussion has been closed.
Answers
I got the answer.. as I am returning the plain list in JSON I should mention dataSrc : "" for the datatables to render it.