How can we reinitialize the datatable?

How can we reinitialize the datatable?

siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

Hello, When I reload the table for someother record using javascript array it gives me an error reinitialization not possible. Can I know how can I overcome this issue and reinitialize the table because this is what I actually wanted.

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    edited November 2017

    Maybe you can post your code or better a link to a page or a test case showing the issue so we can help troubleshoot.

    The info in this tech note might be helpful:
    https://datatables.net/manual/tech-notes/3

    Kevin

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    $('#example').dataTable( {
    paging: false,
    searching: false
    } );

    I had used the above code but was not able to solve the error.

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    Are you using destroy, as described here in the technote?

    Kevin

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    No. I'll try using it now and see.
    Thanks in advance.
    Siddhant

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    Yes! it worked.
    Thanks a Ton!!!

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    But it gives me the warning before using an alert popup. How can I stop that?

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    What is the warning?

    Does the warning have a link to a tech note? If so then try the steps provided in the tech note to start troubleshooting.

    Kevin

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    The same warning in the alert box cannot re-instantiate.

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    It works fine but it pops the warning first and once you block further popups using the checkbox it works fine.

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    Somewhere in your code you must have an additional $('#example').dataTable(); causing the alert. Without seeing your full JS code or a test case with the issue its hard to say why the alert is occurring.

    Kevin

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    Okay! I'll check and see and post a comment regarding the same.
    Thanks !

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    Yes!!! It's done.
    Thanks a ton. It works perfectly fine now.
    Thanks a lot!!!! :)
    Siddhant

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    And how can I give the scrollable property to the table? As the table consists of more than 100 records I cannot scroll through the table. So I just need to give the scrollable property to the table.

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    $.fn.dataTable.ext.errMode = 'none';
    How do you actually use this code and where do you write this code so that the table doesnt popup any alerts.

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    If DataTables is throwing errors, then there is a problem somewhere. Hiding the errors is the wrong thing to do in my opinion. It doesn't make the error go away, it just stops the information reaching you that there is an error happening.

    I would very much recommend you address the error. If you are having problems doing so, link to a test case so I can check it out.

    Allan

  • siddhantjmsiddhantjm Posts: 14Questions: 2Answers: 0

    The line worked.

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Sure - it will hide the error. But it doesn't stop the error from happening!

This discussion has been closed.