What should json data look like for 'No Records"?
What should json data look like for 'No Records"?
kpgraci
Posts: 4Questions: 2Answers: 1
If my server side API returns 0 records the table shows 'Processing..."
I tried to return the following with the same result:
{"data":null,"draw":1,"recordsFiltered":0,"recordsTotal":0}
and
{"data":[null],"draw":1,"recordsFiltered":0,"recordsTotal":0}
How does DataTables recognize that there are no results?
thx
kpg
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Your response should be as shown below.
See this example for demonstration.
See more articles about jQuery DataTables on gyrocode.com.
Yes - it should just be an empty array. The next major version will allow
null
as well, but an empty array is semantically the correct thing to do (i.e. no records).Allan
In my case I can not return an empty array, it's null or something, so this is a workaround that works nicely: (added to the ajax object)