$(document).ready(function () { loader = $('#overlay, #loader'); prTable = $('#AlterOfferTable').DataTable({ ajax: { url: endpoint.GetSupplierAlternativeOffer, type: 'GET', beforeSend: function () { loader.show(); }, complete: function () { loader.hide(); } }, initComplete: initCompleteCallback, columns: colOnAlterOfferTable, responsive: true, language: { emptyTable: "No record available" }, error: errorHandler }); }) $(document).on('change', '.choose-alternative-checkbox', function () { if (this.checked) { // Uncheck others $('.choose-alternative-checkbox').not(this).prop('checked', false); // Reset all rows style $('#AlterOfferListDataTable tbody tr').css({ 'color': '', 'background-color': '' }); // Highlight the selected row $(this).closest('tr').css({ 'color': 'white', 'background-color': 'green' }); } else { // If user unchecks (optional reset) $(this).closest('tr').css({ 'color': '', 'background-color': '' }); } }); function refreshAlterTable() { prTable.ajax.reload(); prDataTable.ajax.reload(); }