bProcessing:开启处理中的加载
sProcessing:页面加载数据显示具体信息
function getDataTable(){
$('#InsectDataTable').dataTable({
'bProcessing': true,//是否显示,处理中....
'bServerSide': true,
'fnServerParams': function (aoData) {
var kaishi;
var tiaoshu;
for(var i=0;i<aoData.length;i++){
if(aoData[i].name == "iDisplayStart"){
kaishi = aoData[i].value;
}else if(aoData[i].name == "iDisplayLength"){
tiaoshu = aoData[i].value;
}
}
var startTime = $.trim($("#startTime").val());
var endTime = $.trim($("#endTime").val());
aoData.push({
"name": "insectData.areaId",
"value": $("#areaId").val()
},{
"name": "insectData.insId",
"value": $("#eqCode").val()
},{
"name": "insectData.startTime",
"value": startTime
}, {
"name": "insectData.endTime",
"value": endTime
},{
"name": "kaishi",
"value": kaishi
}, {
"name": "tiaoshu",
"value": tiaoshu
});
},
"sAjaxSource": basePath + "insectData/getInsectDataList.action", // 获取列表
"sServerMethod": "POST",
"sPaginationType": "full_numbers",
"bPaginate": true, // 翻页功能
"bStateSave": false, // 状态保存
"bLengthChange": true, // 改变每页显示数据数量
"aLengthMenu" : [15, 30, 50],
"bFilter": false, // 过滤功能
"bSort": false, // 排序功能
"bInfo": true, // 页脚信息
"bAutoWidth": false, // 自动宽度
"bDestroy": true,
"iDisplayLength": 15, // 每页显示多少行
"aoColumns": [ {
"sTitle": '排序',
"mDataProp": "no"
}, {
"sTitle": '名称',
"mDataProp": "insName",
"sClass": "conceal"
}, {
"sTitle": '区域名称',
"mDataProp": "areaName",
"sClass": "conceal"
}, {
"sTitle": '编号',
"mDataProp": "eqCode"
}, {
"sTitle": '温度',
"mDataProp": "temperature"
}, {
"sTitle": '湿度',
"mDataProp": "humidity"
}, {
"sTitle": '数量',
"mDataProp": "activation"
}, {
"sTitle": '采集时间',
"mDataProp": "collecTime"
},{
"sTitle": '操作',
"mDataProp": null
}],
"oLanguage": {
"sLengthMenu": "每页显示 _MENU_ 条记录",
"sZeroRecords": "抱歉, 没有找到",
"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据 ",
"sInfoEmpty": "",
"sInfoFiltered": "",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上一页",
"sNext": "下一页",
"sLast": "末页"
},
"sZeroRecords": "没有检索到数据",
"sProcessing":"src='"+basePath+"'/plugins/frame/layui/css/modules/layer/default/loading-"
},
done:function (res) { //返回数据执行回调函数
layer.close(loding); //返回数据关闭loading
},
"fnDrawCallback": function (oSettings) {
$('#equipmentTable tbody tr td').each(function () {
this.setAttribute('title', $(this).text());
});
$("#total").prop("checked", false);
var json = jQuery.parseJSON(oSettings.jqXHR.responseText);
if (json != null && json != undefined) {
totalCount = json.iTotalDisplayRecords;
}
},
"fnInitComplete": function () {
},
"aoColumnDefs": [
{
"aTargets": [3],
"fnRender": function (oObj) {
var eqCode = oObj.aData.eqCode;
return '<a href="javascript:void(0);" οnclick=insectDataTime("' + eqCode + '")>' + eqCode + '</a>';
}
},{
"aTargets": [8],
"fnRender": function (oObj) {
var html = "";
html += "<a data-method=\"repaire\" class=\"layui-btn layui-btn-sm layui-btn-danger layui-btn-radius\" οnclick=deleteData('"+oObj.aData.id+"')>删除</a>"
return html;
}
}]
});
}