Cannot reinitialise datatable
See original GitHub issueI have a problem with data tables. I have 5 tables in differents tabs but with the same options and I use ng-repeat for show the information. I get the data with http request to the api. Ex:
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withBootstrap()
.withOption('rowCallback', rowCallback)
.withOption('deferRender', false)
.withOption('sDom', "<'row'<'col-md-6 hidden-xs'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>")
.withOption('oLanguage', {
"sLengthMenu": "_MENU_",
"sInfo": "Mostrando <strong>_START_ a _END_</strong> de _TOTAL_ entradas"
})
.withOption('sPaginationType', "bootstrap")
.withOption('oClasses', {
"sFilter": "pull-right",
"sFilterInput": "form-control input-rounded ml-sm",
"sWrapper": "dataTables_wrapper form-inline",
"sLength": "dataTables_length blahblahcar"
})
.withOption('initComplete', function(){
//bad but creating a separate directive for demo is stupid
$(".dataTables_length select").selectpicker({
width: 'auto'
});
});
$scope.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef(0),
DTColumnDefBuilder.newColumnDef(1),
DTColumnDefBuilder.newColumnDef(2),
DTColumnDefBuilder.newColumnDef(3),
DTColumnDefBuilder.newColumnDef(4),
DTColumnDefBuilder.newColumnDef(5),
DTColumnDefBuilder.newColumnDef(6).notSortable()
];
When I update a data from a table, one of the others tables have to update, because the data have to go there. But when finish to splice and push to other $scope variable(add the data to the other table) I have this error: Cannot reinitialise DataTable. Can anyone help me?
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
3. Warning: Cannot reinitialise DataTable
This error can often occur when trying to obtain a reference to the DataTable for working with the API. For example, you might...
Read more >Datatables warning(table id = 'example'): cannot reinitialise ...
I am working with datatables example and getting an error like this when loading page: Datatables warning(table id = 'example'): cannot reinitialise data ......
Read more >Datatables warning(table id = 'example'): cannot ... - SPGuides
In this tutorial, we will discuss how to fix the error, Datatables warning(table id = 'example'): cannot reinitialise data table.
Read more >Datatable warning : cannot reinitialise datatable - MSDN
Hi ManDown,. According to your description, this error indicates that DataTables does not allow initialisation options to be altered at any time ......
Read more >cannot reinitialise datatable jquery - Iodocs.com
DataTables warning (table id = 'dataTable'): Cannot reinitialise DataTable. To retrieve the DataTables object for this table, pass no arguments or see the...
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
I did some changes to the code and my problem changes a little(The alert didn’t show, but the table disappeared). The problem happens if I add the scroll plugins to the tables. Explaining all the work, I have a websocket connection that update 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 corresponding table, and I have to use $scope.$apply() to see the visual update, and after using $apply the table disappear from the view.
it is because the data table is trying to reinitialize. when you are having multiple data tables in different tabs, don’t call the methods to fetch data. just change only the tab. it will fix the issue.