question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DTInstances - Reloading of data is not working

See original GitHub issue

When i follow the example here: https://l-lin.github.io/angular-datatables/#/dataReloadWithPromise

I always get an “TypeError: vm.dtInstance.reloadData is not a function” error

I have tried with the exact same code as stated in the example and i have tried to implement it into mine, which is also resulting in the same error.

        var vm = this;
        vm.dtOptions = DTOptionsBuilder.fromFnPromise( function()
        {
            return $resource($scope.sourceUrl).query().$promise;
        })
            .withOption('bInfo', false)
            .withOption('paging', false)
            .withOption('filter', false)
            .withOption('rowCallback', rowCallback);

        // Create the table columns
        vm.dtColumns = [
            DTColumnBuilder.newColumn('customer').withTitle('Kunde / Anzeigedrucke'),
            DTColumnBuilder.newColumn('today').withTitle('Heute'),
            DTColumnBuilder.newColumn('week').withTitle('7 Tage'),
            DTColumnBuilder.newColumn('month').withTitle('30 Tage')
        ];

        vm.newPromise = newPromise;
        vm.reloadData = reloadData;
        vm.dtInstance = {};

        function reloadData()
        {
            var resetPaging = false;
            vm.dtInstance.reloadData(callback, resetPaging);
        }

        function callback(json)
        {
            console.log(json);
        }
<button ng-click="controller.reloadData()" type="button" class="btn btn-info">
                    <i class="fa fa-refresh"></i>&nbsp;Reload data
                </button>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
l-lincommented, Jun 18, 2015

Is the dtInstance variable set in your table?

<table datatable
    dt-options="showCase.dtOptions"
    dt-columns="showCase.dtColumns"
    dt-instance="showCase.dtInstance"></table>
1reaction
nemcuoncommented, May 30, 2016

It also works for me. thanks, I just need to follow this example http://codepen.io/l-lin/pen/Gpgxqo?editors=101

Read more comments on GitHub >

github_iconTop Results From Across the Web

$scope.dtInstance.reloadData() is not a function when ...
I can see that the datatable is reloading new data, but I am still getting the error. – Riples. Feb 9, 2020 at...
Read more >
Datatable Server Side in Angular doesn't show results
On first call, the table is populated but still keeps the "No matching records ... A sample of the table showing as empty...
Read more >
Angular datatables reload
I am new to angular js and datatables. In my page, I have a drop down and search. When I change value in...
Read more >
cannot read property 'dtinstance' of undefined angular datatable
angular-datatables dtinstance not working ... See the example in the documentation about reloading and changing data.
Read more >
Angular Dtinstance Doesnt Exist On Dtelement
The trigger needed to re-render the table. dtTrigger: Subject<any> = new Subject();. segments: number[];. // Object that contains the "segments" data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found