Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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.

share|improve this question
    
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
up vote 0 down vote accepted

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.

share|improve this answer
    
Here's is the link for the fiddle: jsfiddle.net/gss4a17t – anurag619 Dec 27 '15 at 7:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.