参考文章:http://jingyan.baidu.com/article/4d58d5412891c89dd5e9c06f.html
Model日期格式的转化
台取的日期值是类似1418971992000的时间戳格式,转化后为:2014-12-19 14:53:12
1. <span style="color:#333333;">/* 2. * 用户实体类 3. */ 4. //日期转换 5. </span><span style="color:#ff0000;">function convertDate(value){ 6. return Ext.Date.format(new Date(value),"Y-m-d H:i:s"); 7. }</span><span style="color:#333333;"> 8. Ext.define("admin.user.model.UserModel",{ 9. extend:"Ext.data.Model", 10. fields:[ 11. {name:"id",type:"int",srotable:true}, 12. {name:"name",type:"string",srotable:true}, 13. {name:"password",type:"string",srotable:false}, 14. {name:"email",type:"string",srotable:false}, 15. {name:"tel",type:"string",srotable:true}, 16. </span><span style="color:#ff0000;"> {name:"creatTime",type:"string",srotable:true,convert :convertDate}, 17. {name:"lastLoginTime",type:"date",srotable:true, 18. convert :convertDate},</span><span style="color:#333333;"> 19. {name:"status",type:"boolean",srotable:true, defaultValue: true} 20. ], 21. 22. }); 23. </span>
效果: