Why does dataTable doesnt show empty data message?

北城余情 提交于 2019-12-10 12:26:37

问题


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:


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

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


来源:https://stackoverflow.com/questions/41431205/why-does-datatable-doesnt-show-empty-data-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!