Answers for "jquery datatable clear and reload"

2

datatables clear table

const table = $("#yourTable").DataTable();

table.clear().draw(); // make sure to call draw() to see the table empty
Posted by: Guest on November-06-2020
0

jquery datatable destroy and recreate

$("#Table").DataTable().clear().destroy();
            $("#Table").dataTable({
                "sAjaxSource": '@Url.Action("YourMethod", "UrCOntrollerName")',
                "bServerSide": true,
                "bProcessing": false,
                "searching" : false,

                "columns": [
                    {
                        "data": "ID",
                        "autoWidth": true,
                        "searchable": false,
                        "mRender": function (arqs, type, data) {
                            return "<a href='#' onclick='RemoveCombine(this)' data-id='" + data.ID + "'  class='btn-round-sm' title='Remove' style='padding: 5px 5px 5px 5px;'><span>Remove</span></a>";
                        }
                    },
Posted by: Guest on January-05-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language