var table=$(‘.table-sort‘).dataTable({ "Processing": false, // 是否显示取数据时的那个等待提示 "bServerSide": true,//这个用来指明是通过服务端来取数据 "bPaginate": true, //是否显示分页 "sAjaxSource": "${cxtPath}/employee/ListPageByName",//这个是请求的地址 "fnServerData": retrieveData, // 获取数据的处理函数 "columnDefs": [{ "defaultContent": "", "targets": "_all" }], "aoColumns": [ { "mData": "userCode"}, { "mData": "fullName"}, { "mData": "userMail"}, { "mData": "mobile"}, { "mData":"haierUserDeptname"}, { "mData":"wxExist"}, { "mData": function(obj){ return getMyDate(obj.update_time)//update_time是实体类的属性 } }, ], }); //将时间戳格式化 function getMyDate(time){ if(typeof(time)=="undefined"){ return ""; } var oDate = new Date(time), oYear = oDate.getFullYear(), oMonth = oDate.getMonth()+1, oDay = oDate.getDate(), oHour = oDate.getHours(), oMin = oDate.getMinutes(), oSen = oDate.getSeconds(), oTime = oYear +‘-‘+ getzf(oMonth) +‘-‘+ getzf(oDay) +‘ ‘+ getzf(oHour) +‘:‘+ getzf(oMin) +‘:‘+getzf(oSen);//最后拼接时间 return oTime; }; //补0操作,当时间数据小于10的时候,给该数据前面加一个0 function getzf(num){ if(parseInt(num) < 10){ num = ‘0‘+num; } return num; }
时间: 2024-10-16 19:58:20