Why does dataTable doesnt show empty data message?

3.3k Views Asked by At

This is how i return my dataset when no results found for particular search in dataTable serverside processing

data :null
recordsFiltered:"0"
recordsTotal:"0"

but frondend doesnt show any no result found message .its stuck with processing. and console give an error

Uncaught TypeError: Cannot read property 'length' of null

maybe this is null means my data=null.

how can I show datatable default message saying no search results. ? i'm using datatable version 1.10.13 with serverside processing , pls advice

1

There are 1 best solutions below

1
On

You need to return empty array in data property, see sample JSON response below:

{
    "draw": 1,
    "recordsFiltered": 0,
    "recordsTotal": 0,
    "data": []
}