Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Cannot Reinitialise DataTable #1160

@bilalahmed54

Description

@bilalahmed54

I have a WebSocket connection that updates my tables if there is a change in a row data, when the WebSocket get the message of the change, the code do the work and splice and push the data to the model bound with table, and I have to use $scope.$apply() to see the visual update, and after using $apply the table disappear from the view.

This is how I am initializing my data table:

    //Data table options
    vm.dtOptions = {
      dom: '<"top"f>rt<"bottom"<"left"<"length"l>><"right"<"info"i><"pagination"p>>>',
      //default number of records per page
      pageLength: 5,
      //It can be simple or full_numbers
      pagingType: 'full_numbers',
      autoWidth: false,
      responsive: true,
      //to hide search box
      bFilter: false,
      //select from drop down list to select number of records per page
      lengthMenu: [5, 10, 25, 50]
    };

And below id my HTML code:

<table class="dataTable row-border hover"   datatable="ng" dt-options="vm.dtOptions">

            <thead>
            <tr>
              <th translate="callParkGadget.parkedSince"></th>
            </tr>
            </thead>
            <tbody>
                <tr ng-repeat="parkedCall in parkedCallsList">
                     <td data-column="Caller">{{parkedCall.caller}}</td>
            </tr>
    </tbody>
</table>

I am using the following bower dependencies:

"jquery": "3.2.1",
"angular": "^1.6.2",
"angular-datatables": "0.6.0",

And this is the exact message I get in the pop-up:

DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

And after this error table is disappeared and I had to refresh the page to get it in its actual shape. Any help would be highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions