javascript - 数据表不显示
问题描述
我这里有一个点击事件,它显示 jquery 确认中的表数据,但数据表不会显示,即使只显示数据表也不起作用,它只显示普通表。你能告诉我为什么不工作的问题是什么。先感谢您。我把我的表放在 jquery 确认并创建一个数据表函数。
$(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" }
]
});
});
解决方案
推荐阅读
- javascript - 在 React 或 Java 中处理大量记录的正确方法
- gradle - 在 DefaultDependencyHandler 类型的对象上找不到参数 [org.hibernate:hibernate:5.3.7.FINAL] 的方法 intTestImplementation()
- reactjs - 反应:将父母传递给孩子
- python - ValueError:无效的 RGBA 参数:是什么导致了这个错误?
- php - laravel 5.6 - 带有 Laravel API 的 vuejs SPA
- python - 模块“django.db.models”没有属性“TextArea”
- lua - 使用 HttpGet 获取表数据
- rest - 415-不支持的媒体类型
- javascript - 基于 JSON 数据的 React JS 动画
- powerbuilder - 如何在 PowerBuilder 中将函数作为参数传递