$('#dg').datagrid({
url: 'url',
method: 'get',
fitColumns: true,
columns:[[
{field:'itemid',title:'Item ID',width:80},
{field:'time',title:'time',width:120,formatter:DateTimeFormatter},
]],
}
});
//DataGrid日期格式化
function DateTimeFormatter(cellval) {
if (cellval != null) {
var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return date.getFullYear() + "-" + month + "-" + currentDate;
}
}
Easyui Datagrid日期格式化Formatter
最新推荐文章于 2021-05-11 13:36:31 发布