开发者

no record found message in datatable,how?

开发者 https://www.devze.com 2023-03-04 13:56 出处:网络
i am using \'datatable jquery plugin\' with server-side option to 开发者_Go百科load table records.but i don\'t know how i can display a message like \'no data available\' when no data return from mysq

i am using 'datatable jquery plugin' with server-side option to 开发者_Go百科load table records.but i don't know how i can display a message like 'no data available' when no data return from mysql query.as i found the count of returned data which are in json format should be the same as column the table has. i am working with php.

any help would be appreciated .


You could hide the grid and show the message.

Markup:

<div id="noRecords" style="display:none"> There are no records </div>
<div id="dataTableContainer">
 ... (here goes your datatable)
</div>

Javascript:

if(count_of_returned_data == 0){
   $("#noRecords").show();
   $("#dataTableContainer").hide();
}else{
   $("#noRecords").hide();
   $("#dataTableContainer").show();
}

Hope this helps. Cheers

0

精彩评论

暂无评论...
验证码 换一张
取 消