I have here a on click event which display the table data inside the jquery confirm, but datatable wont display and it is not working even the display only of datatable, it only displays the normal table. can you tell me what's the problem why isnt working. thank you in advance. I put my table in jquery confirm and create a datatable function.
$(document).on('click','.btnNotifyRecom',function (){
var BranchCode = $(this).attr("id");
var TranNo = $(this).attr("data-value");
var TranType = $(this).attr("data-value1");
$.confirm({
title: 'Notify to Payroll Department',
content: '' +
'<form action="" class="formName">' +
'<div class="form-group">' +
'<label>Select Employee</label>' +
'<input class="form-control employees MySelect Content" placeholder="Enter ID/Name" list="employeename" id="EmployeeID" />'+
'<datalist id="employeename" class="EmployeeIDsubmit" style="width:10%"></datalist>'+
'</select>' +
'</div>' +
'</form>' +
'<table id="NotifyTable" class="table table-striped table-bordered table-sm cell-border compact stripe" style="width:100%; margin-top: 10px;"> '+
'<thead><tr><th>Employee</th><th>Notify Date</th></tr></thead>' +
' <tbody id="NotifyTable"></tbody>' +
'</table>',
buttons: {
formSubmit: {
text: 'Submit',
btnClass: 'btn-blue',
action: function () {
var Content = this.$content.find('.Content').val();
if (!Content) {
$.alert('Please Select Employee');
return false;
}
else {
$.ajax({
type: 'POST',
dataType: "json",
url: '@Url.Action("SubmitNotifyUser", "SummaryOBTOA")',
data: {
'TranNo': TranNo,
'BranchCode': BranchCode,
'TranType': TranType,
'Content': Content,
'Action': 'NotifyRecome',
}
});
$.alert('Employee Number: ' + Content + ' has been notified');
return false;
}
}
},
cancel: function () {
//close
},
},
onContentReady: function () {
// bind to events
var jc = this;
this.$content.find('form').on('submit', function (e) {
// if the user submits the form by pressing enter in the field.
e.preventDefault();
jc.$$formSubmit.trigger('click'); // reference the button and click it
});
}
});
$('#NotifyTable').DataTable({
"language": {
emptyTable: "No Transaction"
},
ajax: {
url: '@Url.Action("GetNotifyUsers", "SummaryOBTOA")',
data: {
'TranNo': TranNo,
'TranType': TranType,
'BranchCode': BranchCode,
'NotifyType': 'NotifyRecome',
},
dataType: "json",
retrieve: "true",
processing: "true",
serverSide: "true",
type: "POST",
dataSrc: "",
},
order: [],
columnDefs: [
{
targgets: [1],
orderable: false,
}
],
columns: [
{ data: "EmpName" },
{ data: "NotifyDate" }
]
});
});