$(document).ready(function () { loader = $('#overlay, #loader'); const reportTitle = `PR Tracking - as of ${getFormattedDateTime()}`; prTable = $('#PRTable').DataTable({ ajax: $.extend({ url: '/PRMgmt/GetDetailedPRTracking', type: 'GET', }, beforeComplete(loader)), language: { emptyTable: "No record available" }, columns: colOnPRtracking, pageLength: 5, lengthMenu: [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, "All"]], initComplete: function () { initializeColumnSearch({ tableId: '#PRTable', dataTable: prTable, searchableColumns: [ { columnIndex: 1, columnName: 'PR No', placeholder: 'Enter PR Number...', searchType: 'text', searchMode: 'exact', width: '150px' }, { columnIndex: 3, columnName: 'Item No', placeholder: 'Enter Item Number...', searchType: 'text', searchMode: 'exact', width: '150px' }, { columnIndex: 6, columnName: 'Item Name', placeholder: 'Enter Item Name...', searchType: 'text', searchMode: 'contains', width: '200px' }, { columnIndex: 13, columnName: 'Department', placeholder: 'Select Department...', searchType: 'select', searchMode: 'exact', width: '150px' } ] }); const uniqueSearchClass = 'column-search-input-PRTable'; populateSelectOptions(prTable, 13, '.' + uniqueSearchClass + '[data-column="13"]'); restoreSearchFromURL(uniqueSearchClass, '#PRTable'); }, dom: 'lBfrtip', buttons: [ { extend: 'csv', title: reportTitle }, { extend: 'excel', title: reportTitle }, { extend: 'pdf', title: reportTitle } ], rowCallback: rowStatusColorCallback, error: errorHandler, columnDefs: [ { targets: '_all', render: function (data, type, row) { if (type === 'display' && data && data.length > 50) { return '