Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'parentNode' of null on Angular way #150

Closed
MaicolBen opened this issue Dec 11, 2014 · 3 comments
Closed

Comments

@MaicolBen
Copy link

Hi,

I've a strange error that i can't reproduce it on plunker (the real application have numerous plugins), the angular-datatable throw "TypeError: Cannot read property 'parentNode' of null" in this line.

Why nTableWrapper property in settings could be null?

Any help is appreciated!

@l-lin
Copy link
Owner

l-lin commented Dec 12, 2014

The nTableWrapper contains the DOM that DataTable built:
image
Normally, it should not be null.

Try to buil a table without any additional plugins and with the simplest configuration.
Then add one plugin at a time to identify the culprit.

@MaicolBen
Copy link
Author

The table haven't plugins, it seems to me that the table is not ready when the directive is applied. Because when I create other directive that apply the plugin after a second work! But the behavior is slow:

.directive('myDatatable', function($compile, $timeout){
    return function(scope, elem, attr) {
        $timeout(function(){
            elem.attr('datatable', 'ng');
            elem.removeAttr('my-datatable');
            $compile(elem)(scope);
        }, 1000);
  };
})

@nashtsai
Copy link

I have exactly the same problem as well, I've spotted this problem is caused by:

DTDefaultOptions.setLanguageSource('http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/xxxx.json')

or

$scope.dtOptions = DTOptionsBuilder
    .newOptions()
    .withLanguage({
       sUrl:'http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/xxxx.json'
      })

Suspected that due to language resources is received asynchronously and applied after data models has been set into datatable caused this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants