1

I cannot access the API methods mentioned in this doc, as well as the destroy method described here .

the HTML:

<table datatable dt-instance="dtInstance" dt-options="dtOptions" dt-columns="dtColumns" class="table-striped">
            </table>

In my controller I have:

    a.dtInstance = {};

    var getTableData = function() {
        var deferred = $q.defer();
        deferred.resolve(tablecontent_array); 

        return deferred.promise;
    };

    a.dtOptions = DTOptionsBuilder.fromFnPromise( getTableData())
            .withPaginationType('full_numbers');

    a.dtColumns = [
                    DTColumnBuilder.newColumn('id').withTitle('ID').notVisible(), //
                    DTColumnBuilder.newColumn('groupby').withTitle('Group By').notSortable(),
                    DTColumnBuilder.newColumn('value').withTitle('value').notSortable()
                ]

'tablecontent_array' contains the data.

When I try to modify/destroy the table I get an error.

a.dtInstance.rerender()

Error message:

TypeError: a.dtInstance.rerender is not a function

My aim is to modify the table after certain user operations. The table data in rendering fine. But I cannot access any of its API methods.

May be I am doing some mistake while doing so, I am new to angular-datatable, any help/suggestions regarding this issue will be helpful.

Community
  • 1
  • 1
anurag619
  • 702
  • 8
  • 17
  • There can be multiple reasons for this, but hard to guess what exactly you have done wrong - can you show the full code or setup a plnkr or fiddle that reproduces the problem? The misbehaviour is not caused by the code provided in the question. – davidkonrad Dec 25 '15 at 18:59

1 Answers1

0

After dwelling into the question for days I tried creating plnkr as suggested in the comment. It turns out I was not using the correct versions of datatables, Angular and host of other Libraries. Corrected that and the issue was resolved.

Even then my objective of adding/appending new column(s) was not resolved in angular way. However some folks posted possible solutions using jquery datatables.

anurag619
  • 702
  • 8
  • 17