Our product owner would like our empty tables to display only the table title when there is no data in the table. I can not stop the dataTable from creating a line with the message "empty ...".
Here is the code that I use to initialize the dataTable. I know some things are wrong here. I experimented. :)
$('#InBox').dataTable({ "bFilter": false, "bPaginate": false, "bLengthChange": false, "bInfo": false, "oLanguage": { "sEmptyTable": '', "sInfoEmpty": '' } });
Here is the code I tried to put in the initTableTable function, but I'm not sure how to make it work.
var anRows[0] = document.createElement('tr'); if (typeof oSettings.asStripClasses[0] != 'undefined') { anRows[0].className = oSettings.asStripClasses[0]; } var nTd = document.createElement('td'); nTd.setAttribute('valign', "top"); nTd.colSpan = oSettings.aoColumns.length; nTd.className = oSettings.oClasses.sRowEmpty; if (oSettings.fnRecordsTotal() > 0) { if (oSettings.oLanguage.sZeroFilterRecords.indexOf("_MAX_") != -1) oSettings.oLanguage.sZeroFilterRecords = oSettings.oLanguage.sZeroFilterRecords.replace("_MAX_", oSettings.fnRecordsTotal()); nTd.innerHTML = oSettings.oLanguage.sZeroFilterRecords; } else { nTd.innerHTML = oSettings.oLanguage.sZeroRecords; } anRows[iRowCount].appendChild(nTd);
Dan
jquery datatable
dcary
source share