Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I created a directive for JQuery DataTables in AngularJS and it works with each data source types, except server-side processing. With the latter I get an error saying: TypeError: Cannot read property 'aDataSort' of undefined.

I have the following code in the directive's link function:

var buildTableFromServer = function() {
    var table = $(el).find('table');

    if (! $.fn.DataTable.isDataTable(table)) {
        table.DataTable({
            "processing": true,
            "serverSide": true,
            "ajax": scope.dataSource
        });
    }
}

The error stack I get points to the line where I call .DataTables() (after some lines in DataTables JS file).

I checked and table is found, scope.dataSource is set (it's a URL string, the one used in the example). Moving the DT code outside of the if block does nothing either.

What could be the problem? If needed, I can provide more code, but I don't think any more would help.

share|improve this question
    
Were you able to resolved this issue? Even I am getting same error. – user2235057 Jun 1 at 7:47
    
No, I made a workaround, but sadly I don't remember anymore. :/ – Martin Fejes Jun 3 at 12:56

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.