ExtJS grid中如何显示时间
效果:

实现代码:
store : new Ext.data.JsonStore({
url : 'myAction.action',
root : "root",
totalProperty : 'totalProperty',
fields : [{
name : mytime,
type : 'date',
dateFormat : "Y-m-dTH:i:s",
mapping : 'mytime'
}]
ColumnModel:new Ext.grid.ColumnModel{
header : '时间',
dataIndex : 'mytime',
width : 20,
sortable : false,
menuDisabled : true,
renderer : function(value) {
return value.dateFormat('Y-m-d H:i');
}
}]
在后台java程序中将对字段使用的是Timestamp类型
本文介绍了如何在ExtJS Grid中正确显示时间字段的方法。通过配置JsonStore中的字段类型及日期格式,结合ColumnModel中的renderer函数,实现了Timestamp类型数据的有效展示。
1074

被折叠的 条评论
为什么被折叠?



