-
Notifications
You must be signed in to change notification settings - Fork 496
Cannot Reinitialise DataTable #1160
Description
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.