This topic contains 1 reply, has 2 voices, and was last updated by Jai Jai 5 months, 1 week ago.

mDataTable.destroy() behavior


  • arvid
    Participant

    Posts: 2
    Member Reply #17815

    Hi,

    I’m using mDataTable with local data. When I want to update the dataset I use destroy() and create a new datatable at its place.
    There are two things sometimes run into:

    1. destroy() seems to delete its parent container, so initialising again with <div id="myTablePlaceholder" /> and $('#myTablePlaceholder').mDatatable(options); is then impossible. Can you confirm if this is the desired behavior?
    2. When you navigate via pagination to the end, but load less data, the state seems corrupt. Does destroy() make sure (localStorage) state is reset?

    Thanks!

    Jai
    Jai
    Keymaster

    Posts: 2700
    Support Staff Reply #18171

    Hi 🙂

    mDatatable destroy method revert the state of the container element. Please check the sample code here;

    /src/js/demo/default/custom/crud/metronic-datatable/api/methods.js

    https://keenthemes.com/metronic/preview/?page=crud/metronic-datatable/api/methods&demo=default

    currently destroy method does not reset localStorage state. We will fix it.

    Thanks

You must be logged in to reply to this topic.