let objGrid = new DataTable('#SearchTable'); function fillGrid() { $("#SearchTable").find("tbody tr").remove(); objGrid = $("#SearchTable").DataTable({ "lengthMenu": [[10, 20, 30, 50], [10, 20, 30, 50]], "pageLength": 10, "fixedHeader": true, "processing": true, "serverSide": true, "searching": false, "buttons": [], "paging": true, "ordering": true, "bLengthChange": true, "columns": [ { "data": "ID" }, { "data": "Name" }, { "data": "ProvinceTitle" }, { "data": "CityTitle" }, { "data": "MobileNumber" }, { "data": null }, //{ "data": "barnameId", "visible": false } ], "columnDefs": [{ "searchable": false, "orderable": false, "targets": [5], "render": function (data, type, row, meta) { return ""; } }, ], "language": { "url": "/Content/dataTables/plug-ins/i18n/Persian.json" }, "ajax": { "url": "/Company/CompanyHome/GetCompanyList", "type": "POST", "data": function (d) { d.function = "GetCompanyList", }, "error": function (error) { $("#SearchTable").find("tbody tr").remove(); $("#SearchTable").append("

" + error.responseText + "

"); $("#SearchTable").parents("div.dataTables_wrapper").find("div.dataTables_processing").hide(); } }, "initComplete": function (setting, json) { } }); } $(document).ready(function () { debugger; fillGrid(); });