Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery datatables don't show table if haven't data
    text
    copied!<p>I'm using jquery datatables with server side fetch data, my problem is when table of data is empty datatables hide table and don't show that, i want to show table with no any data on table message, how to have this option?</p> <pre><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("&lt;ul class='styledlist' style='width:80px !important;'&gt;&lt;img src='http://localhost/shirazee/UI/images/icons/publish.png' style='border:none;'/&gt;&lt;/ul&gt;"); // }, "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&lt;nTrs.length ; i++ ) { var iDisplayIndex = oSettings._iDisplayStart + i; var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]; if ( sGroup != sLastGroup ) { var nGroup = document.createElement( 'tr' ); var nCell = document.createElement( 'td' ); nCell.colSpan = iColspan; nCell.className = "group"; nCell.innerHTML = sGroup; nGroup.appendChild( nCell ); nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); sLastGroup = sGroup; } } }, "aoColumnDefs": [ { "bVisible": false, "aTargets": [ 0 ] } ], "aaSortingFixed": [[ 0, 'asc' ]], "aaSorting": [[ 1, 'asc' ]], "fnServerParams": function ( aoData ) { aoData.push( {"name": "id" , "value": "i.id" }, {"name": "subject" , "value": "i.subject" }, {"name": "date_time", "value": "i.date_time"} , {"name": "posted_by", "value": "u.username"} , {"name": "ctitle" , "value": "c.title"} , {"name": "etitle" , "value": "e.title"}, {"name": "istatus" , "value": "i.status"}, {"name": "join" , "value": "JOIN categories c ON i.category = c.id JOIN status_topics e ON i.status = e.id JOIN users u ON i.posted_by = c.id"}, {"name": "action" , "value": "topics" } )} }); function clickRowHandler_topics() { $('#showTopics tbody tr').bind('click', function () { var aData = oTable_topics.fnGetData( this ); iId_topics = aData[1]; }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload