I am using data tables and am adding options to the JS code, the changes work but I keep on getting a popup warning. How can I stop the warning?
$(document).ready(function() {
$('#ideas').dataTable( {
"aLengthMenu": [[5, 10, 15, -1], [5, 10, 50, "All"]]
});
});
If you just want to get rid of the alert box (eg "stop the warning") add this as the first line of your $(document).ready
:
$.fn.dataTableExt.sErrMode = 'throw';
Now datatables will throw an error visible as "uncaught error: Datatables warning ..." in the console instead of the ugly alert-box.
However, you have an error in your code / data regardless the error now is thrown silently.
The error
"DataTables warning (table id = 'XXX'): Requested unknown parameter 'XXX' from the data source for row X" is raised when there is a mismatch between the number of columns in the <table>
and the number of columns in the data.
<thead>
<th>col A</th>
<th>col B</th>
</thead>
Inserting
<tr>
<td>test test</td>
</tr>
or
<tr>
<td colspan="2">test test</td>
</tr>
Would reproduce exactly that error. So examine your data again ..
You should use "bDestroy": true prop in order to populate table during post back
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With