I have two rows within my datatables as follows.
<tr><td></td><td></td><td></td></tr>
<tr><td colspan="3"></td></tr>
These rows repeat themselves for every record on datatables. So as you can imagine, I get this error all the time and just need it disabled unless you want to figure out how to make it work.
So how do you disable the warning: DataTables warning Requested unknown parameter from the data source for row
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.
DataTables warns about the use of them by default, as the majority of the time they are not intended for display - for example, rather than showing null in the table, you might want to show Not yet set, or simply an empty string (empty cell). For this, DataTables has a columns. defaultContent option.
aoColumnDefs: This array allows you to target a specific column, multiple columns, or all columns, using the aTargets property of each object in the array (please note that aoColumnDefs was introduced in DataTables 1.7).
When using the ajax option to load data for DataTables, a general error can be triggered if the server responds with anything other than a valid HTTP 2xx response.
The warning message is: DataTables warning: table id= {id} - Requested unknown parameter ' {parameter} ' for row {row-index} {row-index} is the DataTables internal row index for the rwo that has triggered the error.
For example the error message in read: Requested unknown parameter 'Name' for row 0. This will indicate that a column which uses columns.data has been unable to obtain valid data to display - for example: would produce this error if the data source object for the row had no Name parameter or the data was null or undefined.
Warning: Requested unknown parameter 4. Warning: Requested unknown parameter This is possibly the most cryptic warning message that DataTables will show.
Each cell in DataTables requests data, and when DataTables tries to obtain data for a cell and is unable to do so, it will trigger a warning, telling you that data is not available where it was expected to be. The warning message is: {row-index} is the DataTables internal row index ( row ().index ()) for the row that has triggered the error.
$.fn.dataTable.ext.errMode = 'none';
$('#table').on( 'error.dt', function ( e, settings, techNote, message ) {
console.log( 'An error has been reported by DataTables: ', message );
} ) ;
Above code will solve problem and also log error in console so you can solve the error
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