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
精彩评论