How to reload DOM datatable ?

How to reload DOM datatable ?

denverdenver Posts: 3Questions: 1Answers: 0

I am using Dom datatable. I want to add

paging: false,
        initComplete: function() {
            let api = this.api();
        setInterval(function() {
            api.ajax.reload();
        }, 1000);
        },

I added codes. But I am getting popup error. Reload is not working.
Codepen Preview : https://codepen.io/themecode/pen/dyevdEy
Please help me

Answers

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin

    You aren't using ajax to load data for the table, so ajax.reload() isn't going to do anything to help you!

    How are you getting the new data for your DataTable? If it is DOM sourced then you need to use the DataTables API to update the DataTable.

    Allan

  • denverdenver Posts: 3Questions: 1Answers: 0

    ohh . I am not a developer. I dont know Jquery , Ajax.. Sorry.. Thanks for your reply

  • denverdenver Posts: 3Questions: 1Answers: 0
    edited September 2022

    Anyways, have any option for setInterval(function and reload DOM datatable ?

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Datatables doesn't have any built in methods to reload DOM sourced table.

    The first question to answer is the one Allan had:

    How are you getting the new data for your DataTable?

    Deepening on how you are doing this will determine what Datatables methods need to be used. Start by telling us how will fetch the updated table data.

    Kevin

Sign In or Register to comment.