Remove alert message that warns you against null or undefined values in your data.
See original GitHub issueI’m stumped on how to get rid of the alert message that warns you against null or undefined values in your data.
Alert Error message: DataTables warning: table id=LeadDataTable - Requested unknown parameter ‘lastName’ for row 2. For more information about this error, please see http://datatables.net/tn/4
Documentation suggest I use: columns.defaultContent and set that to a blank string:
http://datatables.net/reference/option/columns.defaultContent
I’m thinking I’m setting this incorrectly:
$scope.dtColumnDefs = {
"defaultContent": " "
};
html:
<table id="LeadDataTable" paginate-table datatable="" dt-options="dtOptions" dt-columns="dtColumns" dt-column-defs="dtColumnDefs" class="table table-striped table-bordered"></table>
controller:
$scope.dtColumnDefs = {
"defaultContent": " "
};
$scope.reloadData = function() {
$scope.dtOptions.reloadData();
};
$scope.dtOptions = DTOptionsBuilder.fromFnPromise(function() {
return LeadService.find();
})
.withBootstrap()
.withPaginationType('full_numbers')
.withOption('createdRow', function(row, data, dataIndex) {
// Recompiling so we can bind Angular directive to the DT
$compile(angular.element(row).contents())($scope);
})
.withOption('rowCallback', function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$('td:first, td:nth-child(2)', nRow).unbind('click');
$('td:first, td:nth-child(2)', nRow).bind('click', function() {
$scope.$apply(function() {
$scope.navToEdit(aData._id);
});
});
return nRow;
});
$scope.dtColumns = [
DTColumnBuilder.newColumn('firstName').withTitle('First Name'),
DTColumnBuilder.newColumn('lastName').withTitle('Last Name'),
DTColumnBuilder.newColumn(null).withTitle('Actions').notSortable()
.renderWith(function(data, type, full, meta) {
var id = data._id;
//var button = '<button class="btn btn-danger" ng-click=
var navToEdit = "navToEdit('" + id + "')";
var remove = "remove('" + id + "')";
return '<button class="btn btn-warning" ng-click="' + navToEdit +'">' +
' <i class="fa fa-edit"></i>' +
'</button> ' +
'<button class="btn btn-danger" ng-click="' + remove + '">' +
' <i class="fa fa-trash-o"></i>' +
'</button>';
})
];
Issue Analytics
- State:
- Created 9 years ago
- Comments:5
Top Results From Across the Web
The operand of a 'delete' operator must be optional / Object is ...
Trying to access a property of undefined ... According to the MDN the find() method can return undefined : If no values satisfy...
Read more >Handling Null and Other Special Values - Tableau Help
When your data contains any of these special values, Tableau cannot plot them in the view. Instead, it displays an indicator in the...
Read more >Resolve nullable warnings | Microsoft Learn
This set of warnings alerts you that you're assigning a variable whose type is nonnullable to an expression whose null-state is maybe-null.
Read more >Interaction: alert, prompt, confirm
The call to prompt returns the text from the input field or null if the input was canceled. For instance: let age =...
Read more >4. Warning: Requested unknown parameter - DataTables
It is a short error message as it needs to cope with all of the data source ... there is no data there,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can also do something like
$.fn.dataTable.ext.errMode = 'none'; $('#table-id').on('error.dt', function(e, settings, techNote, message) { console.log( 'An error occurred: ', message); });
thanks!