table.render({
page: true,
elem: '#articleList',
url: '../../user',
cols: [[
{type: 'checkbox'},
{field: 'username', title: '用户名称',width:'11%'},
{field: 'sex', title: '性别', width:'11%'},
{field: 'status', title: '状态', templet: '#status',width:'11%'},
{field: 'updated', title: '最近修改时间',width:'14%',
templet:
function
createTime(d){
return
new
Date
(parseInt(d.updated)).toLocaleString()
}
},
]]
,done:
function
(res,curr,
count
){
$(
"[data-field='sex']"
).children().each(
function
(){
if
($(this).text() == '1'){
$(this).text('男');
}
else
if
($(this).text() == '0'){
$(this).text('女');
}
});
}
});
Date
.prototype.toLocaleString =
function
() {
var
y = this.getFullYear();
var
m = this.getMonth()+1;
m = m<10?'0'+m:m;
var
d = this.
getDate
();
d = d<10?(
"0"
+d):d;
var
h = this.getHours();
h = h<10?(
"0"
+h):h;
var
M = this.getMinutes();
M = M<10?(
"0"
+M):M;
var
S=this.getSeconds();
S=S<10?(
"0"
+S):S;
return
y+
"-"
+m+
"-"
+d;
};