jQuery datatables dont show table if have'nt data
jQuery datatables dont show table if have'nt data
i'm using jquery datatabls with server side fetch data, my problem is when table of data is empty datatables hide table and dont show that, i want to show table with no any data on table message, how to have this option?
[code]
oTable_topics =$('#showTopics').dataTable({
"bLengthChange": false,
"bStateSave": true,
"iDisplayLength": 12,
"bScrollCollapse": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"bProcessing": true,
// "fnCreatedRow": function( nRow, aData, iDataIndex ) {
// $('td:eq(5)', nRow).html("");
// },
"fnDrawCallback": function(oSettings) {
clickRowHandler_topics();
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('tbody tr', oSettings.nTable);
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i
[code]
oTable_topics =$('#showTopics').dataTable({
"bLengthChange": false,
"bStateSave": true,
"iDisplayLength": 12,
"bScrollCollapse": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"bProcessing": true,
// "fnCreatedRow": function( nRow, aData, iDataIndex ) {
// $('td:eq(5)', nRow).html("");
// },
"fnDrawCallback": function(oSettings) {
clickRowHandler_topics();
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('tbody tr', oSettings.nTable);
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i
This discussion has been closed.
Replies
Allan
In your model (or whatever you call your transport), check for an empty result set there.
If you have no data to return from your query, simply return a blank record in aaData, like so:
[code]
if (!isset($return['aaData']) ) {$return['aaData'][] = array('','', ... repeat for each field expected); }
[/code]
Easy peasy.