Answers for "datatable destroy and reinitialize with ajax"

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
1

reinitialize datatable on button click

$(function() {
    $('#proces_input').on('click', function() {
        alert('Im in')
        var table = $('#dt_110x_complex').DataTable({
            paging : true,
            destroy : true,    <-------Added this 
            scrollY: 300,
            ajax: "{{ url_for('complex_data') }}"
        });
    });
});
Posted by: Guest on July-12-2021

Code answers related to "datatable destroy and reinitialize with ajax"

Code answers related to "Javascript"

Browse Popular Code Answers by Language