Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

DTInstances - Reloading of data is not working #347

@Chalkin

Description

@Chalkin

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions