var baseParm = {
info: false,
filter: false,
destroy: true,
ordering: false,
processing: true,
lengthChange: false,
serverSide: true
};
$('#operConfigGrid').DataTable($.extend({}, baseParm, { ajax: function (pageData, callback, settings) { var send = { draw: pageData.draw, pagination: Math.floor(pageData.start / pageData.length) + 1, pageLength: pageData.length, account: basic.account }; common.post('/platform/agent/getOperLog', send, function (result) { var data = { data: result.rows.operLogs, recordsTotal: result.total, recordsFiltered: result.total }; callback(data); $('.operationform span[name=statusCn]').html(result.rows.statusCn || "--"); $('.operationform input[type=hidden]').val(basic.account || "--"); }); }, columns: [ {title: '时间', data: 'createTime', render: ''}, { title: '操作记录', data: 'operation1', render: function (value, type, row) { return row.operation; }, className: 'text-left col-xs-5' }, { title: '备注内容', data: 'comment', render: function (value, type, row) { return value || '-'; } }, {title: '操作人', data: 'operator', render: ''} ] }));
传给后台的参数:json:{"draw":1,"pagination":1,"pageLength":10,"tcAccount":"A180507CDFTS-TCNX"}
后台返回的数据:
var logData=[
{"content":"处理内容","createTime":"2018-05-07 15:00:00","operator":"张三","remark":"备注信息","status":2,"statusCn":"成功"}
]
$logList.DataTable( { info: false, paging: false, serverSide: false, autoWidth: false, data: logData||[], columns: [ { title: '时间', className: 'text-center', width: '160px', render: function (data, type, row, meta) { return '<span>' + dealNullValue(row.createTime) + '</span>'; } }, { title: '处理内容', className: 'text-left', render: function (data, type, row, meta) { return '<span>' + dealNullValue(row.content) + (row.remark?',备注:'+row.remark:'')+'</span>'; } }, { title: '处理状态', className: 'text-center', width: '120px', render: function (data, type, row, meta) { return '<span>' + dealNullValue(row.statusCn) + '</span>'; } }, { title: '处理人', className: 'text-center', width: '120px', render: function (data, type, row, meta) { return '<span>' + dealNullValue(row.operator) + '</span>'; }, } ] });