question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove alert message that warns you against null or undefined values in your data.

See original GitHub issue

I’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>&nbsp;' +
        '<button class="btn btn-danger" ng-click="' + remove + '">' +
        '   <i class="fa fa-trash-o"></i>' +
        '</button>';
    })
];

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
kevosomicommented, Apr 14, 2016

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); });

1reaction
mihrichcommented, Mar 31, 2016

thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found