dt-instance directive not working for controllerAs
See original GitHub issuevm.dtInstance is not set after the table is rendered – all other vm.<whatever’> work
html
<div class="vers1 v1-booklets-booklets" ng-controller="BookletsBookletsListCtrl as vm">
<table id="v1-booklets-booklets" datatable="" dt-options="vm.dtOptions" dt-columns="vm.dtColumns" class="{{vm.dtClasses}}" dt-instance="vm.dtInstance"></table>
<div class="hide-remove"><action-icon-set id="TAB-Booklets" class="dataTables_actionIcons" data-entity-id="41" data-entity-type="booklet" actions="refreshTable,newBooklet"/></div>
</div>
javascript
vm.dtInstance.reloadData();
TypeError: Cannot read property ‘reloadData’ of undefined at booklets-booklets-list.js:94 at Scope.parent.$get.Scope.$emit (angular.js:14793) at angular-action-icons.js:117
I have to use the old method – and I get warned
angular.js:11699 “DTInstances.getLast()” and “DTInstances.getList()” are deprecated! Use the “dt-instance” to provide the datatables instance. See https://l-lin.github.com/angular-datatables/#/manipulatingDTInstances for more information.
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Angular DataTable not populating DTInstance - Stack Overflow
I was able to fix it by this https://github.com/l-lin/angular-datatables/issues/365. The problem was due to I initialized the dataHolder ...
Read more >angular-datatables - npm
Start using angular-datatables in your project by running `npm i ... You can use the directive dt-instance where you provide a variable that ......
Read more >Server side processing and sending additional params
I'm initially loading the table below with some default data. ... I've sent back to it and then reload datatable, but this isn't...
Read more >fb-angular-datatables - NPM Package Overview - Socket - Socket.dev
Angular module that provides a datatable directive along with datatable options ... Socket installs a Github app to automatically flag issues on every...
Read more >DataTables, AngularJS, and Django | Stacks & Q's - Qualtrics
You can introduce the White Noise module into your code to solve this problem. First, import it in your wsgi.py file, by adding...
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
Try to use Fetching DataTable Instances.
You can implement it:
And in your html…
Hope this helps…
This is the solution:
js: vm.dtInstance = {};
vm.dtInstanceCallback = function(_dtInstance) { vm.dtInstance = _dtInstance; vm.dtInstance.reloadData(); //or something else… }
html: dt-instance=“vm.dtInstanceCallback”