dtInstance not initialized correctly
See original GitHub issueI have modified datatables to new version 0.4.3 and i want to use $scope.dtInstance.reloadData()
. But my object dtInstance is initialized like this:
- and it should by like your example:
{
"id": "foobar",
"DataTable": oTable,
"dataTable": $oTable,
"reloadData": function(callback, resetPaging),
"changeData": function(newData),
"rerender": function()
}
- strange thing is, when i call
$scope.dtInstance.reloadData()
, no error is show. It looks like that method works (but dont reload data) even if that method is not in object. - when i use older
$scope.dtOptions.reload = true
, it reload data (and dont throw error again)
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
dtInstance not initialized correctly #345 - CodePen
1. angular.module('datatablesSampleApp', ['datatables']). ; 2. controller('SimpleCtrl', function ($scope, DTOptionsBuilder, DTColumnBuilder, $http) { ; 3. $scope.
Read more >Datatables not initializing after reload operation in angular 7 app
i implemented the jquery.datatables in my Angular 7, i installed all the node modules and did the necessary configuration, and included the ...
Read more >Cannot reinitialise DataTable - but it works!
I am currently integrating it into a Bootstrap 4 theme which initialises everything from an external minimised js file. Additional DataTables ...
Read more >Using Angular DataTables to build feature-rich tables
The Angular DataTables library combines Angular directives with jQuery's DataTables plugin. See how to use it in our tutorial.
Read more >Cannot reinitialise DataTable with Angular Datatable-angular.js
The above answer @Adrita Sharma was not working for me, it was throwing this error. core.js:9110 ERROR TypeError: Cannot read property 'dtInstance' of ......
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 ran into this problem myself. I tried the pen and it did work.
So I think what is happening based on some of the other angular things I’ve used is that the datatable directive is actually making its own scope, so if you do the following in your controller…
…and then in your HTML…
…it seems to work. If this is intended, it should probably be made more clear in the documentation.
I can attest that what @rosshays said is true. If your controller is nested inside another controller, you must use a nested scope or dtInstance will not work properly.