I get this error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is

I get this error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is

offir.peeroffir.peer Posts: 9Questions: 4Answers: 0

When I try to use the destroy() function on my datatable I get this error.
Take a look at my question here:
http://stackoverflow.com/questions/40628667/datatables-error-when-using-destroy-failed-to-execute-insertbefore-on-node

I try to reproduce this(Bug maybe?), in my plunker but without success.
https://plnkr.co/edit/guXUsqah2p7TpnsjQVBo?p=preview

Why do I get this error when I try to destroy the table, I am using the same version of datatable as in my Demo.

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    My guess is that the original node has been removed itself, but we'd really need a test case showing the issue to be able to debug it.

    Allan

  • offir.peeroffir.peer Posts: 9Questions: 4Answers: 0

    The fiddle I added is almost the exact thing I do in my project, same versions of jquery and datatables, any idea what could be the problem?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Not really. You noted above that you weren't able to replicate the issue in Plnkr, which suggests either a version difference or some other code difference that is triggering the issue in your local code. That's why I mentioned above that we'd need to be able to see the error to understand what is going on.

    Having said all that - I've just spotted one thing. Your dom doesn't have a t option. That is required since the t is the table. Try adding that in.

    Allan

  • offir.peeroffir.peer Posts: 9Questions: 4Answers: 0

    But in plunker it works fine without the "t" in the dom.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Yup - I'm surprised by that. That's the only thing I spotted as odd though. Did you try it? If it isn't that, I'd need a way to be able to see the error to be able to offer any help as I can't guess what the issue is.

    Allan

  • offir.peeroffir.peer Posts: 9Questions: 4Answers: 0

    This guy had the same problem, I don't know if he solved it, but can you take a look, maybe you will spot something there?
    https://datatables.net/forums/discussion/28081/how-to-update-table-when-dom-changes-destroy-init-crash

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Here is the code he used working. I didn't follow up on that post since he notes he got it working.

    Allan

This discussion has been closed.