$(function () {
usersJifenHistory.Datatable = $("#usersJifenHistoryDataTable").dataTable({
pageLength: 50,
language: {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
},
serverSide: true,
"ajax": _ctx + "/admin/zyh/usersJifenHistory/data.json?userid="+ _userId,
"columns": [
{
"data": "id",
"width": "4%",
"render": function (data) {
return "<input type='checkbox' class='selectable-checkbox' name='id' data='" + data + "'>";
}
},
{
"data": "old_jifen",
"render": function (data,type,row) {
row.old_jifen = Number(row.old_jifen).toFixed(0);
row.change_jifen = Number(row.change_jifen).toFixed(0);
row.new_jifen = Number(row.new_jifen).toFixed(0);
var tmp="";
if(row.is_jifen_state==1){
tmp += "<s style='color:#909090;'>"+row.old_jifen+"</s><span style='color:green;'> + </span>"+"<span style='font-size:20px;color:green;'>"+row.change_jifen+"</span>"+" = "+"<span style='color:black;'>"+row.new_jifen+"</span>";
}else{
tmp += "<s style='color:#909090;'>"+row.old_jifen+"</s><span style='color:red;'> - </span>"+"<span style='font-size:20px;color:red;'>"+row.change_jifen+"</span>"+" = "+"<span style='color:black;'>"+row.new_jifen+"</span>";
}
return tmp;
}
},
/*{
"data": "new_jifen",
"render": function (data) {
return renderDefault(data);
}
},
{
"data": "change_jifen",
"render": function (data) {
return renderDefault(data);
}
},*/
{
"data": "change_time",
"render": function (data) {
return renderDate(data);
}
},
{
"data": "is_jifen_state",
"render": function (data) {
if(data&&data==1){
return "收入";
}
if(data&&data==0){
return "支出";
}
}
},
{
"data": "is_success",
"render": function (data) {
if(data&&data==0){
return "失败";
}
else{
return "成功";
}
}
},
{
"data": "reason",
"render": function (data) {
return renderDefault(data);
}
},
{
"data": "id",
"width": "16%",
"render": function (data,type,row) {
return "<a class='btn btn-xs btn-info dim dataEdit' data='" + data + "'><i class='fa fa-edit'></i>编辑1</a> ";
}
}],
deferRender: true
});
$('#usersJifenHistoryDataTable').on('draw.dt', function () {
usersJifenHistory._initEdit();
});
datatable数据展示
最新推荐文章于 2024-04-08 17:19:41 发布