[Vuejs]-How to refresh datatables with new data in Laravel vuejs?

0👍

I found the solution I destroy the datable in the create function $(‘#sampleTable’).DataTable().destroy(); and then create it back like below

  create() {

    this.form.post('api/user').then(() => {
    $("#addnew").modal("hide");
    toast.fire({
    icon: "success",
    type: "success",
    title: "Information Created Successfully!"
    });
    $('#sampleTable').DataTable().destroy();// here I destroyed the table 
    Fire.$emit("refreshPage");// here I recreated the table
    this.form.reset();
    })
    .catch(er => {
    console.log(er);
    });
},



    

Leave a comment