let isSorting = false; $(document).ready(function () { loader = $('#overlay, #loader'); const reportTitle = `RR Report - as of ${getFormattedDateTime()}`; receivingTable = $('#ReportTable').DataTable({ ajax: $.extend({ url: '/Receiving/GetRRReport', type: 'GET', data: function (d) { d.dateFrom = $('#dateFrom').val(); d.dateTo = $('#dateTo').val(); d.isSorting = isSorting; }, }, beforeComplete(loader)), language: { emptyTable: "No record available" }, columns: colOnRRReport, pageLength: 5, lengthMenu: [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, "All"]], initComplete: function () { initializeColumnSearch({ tableId: '#ReportTable', dataTable: receivingTable, searchableColumns: [ { columnIndex: 0, columnName: 'PR No', placeholder: 'Enter PR Number...', searchType: 'text', searchMode: 'exact', width: '150px' }, { columnIndex: 1, columnName: 'Item No', placeholder: 'Enter Item Number...', searchType: 'text', searchMode: 'exact', width: '150px' }, { columnIndex: 4, columnName: 'Item Name', placeholder: 'Enter Item Name...', searchType: 'text', searchMode: 'contains', width: '200px' }, { columnIndex: 11, columnName: 'Department', placeholder: 'Select Department...', searchType: 'select', searchMode: 'exact', width: '150px' } ] }); const uniqueSearchClass = 'column-search-input-ReportTable'; populateSelectOptions(receivingTable, 11, '.' + uniqueSearchClass + '[data-column="11"]'); restoreSearchFromURL(uniqueSearchClass, '#ReportTable'); }, dom: 'lBfrtip', buttons: [ { extend: 'csv', title: reportTitle }, { extend: 'excel', title: reportTitle } ], error: errorHandler, columnDefs: [ { targets: '_all', render: function (data, type, row) { if (type === 'display' && data && data.length > 50) { return '