使用easyui框架 设置时间格式
之前做的一个商城项目,后台系统页面使用Easyui做的,记录一个当时卡住的地方:
首先通过<table>标记创建数据网格(datagrid)
<table class="easyui-datagrid" id="contentList" data-options="toolbar:contentListToolbar,singleSelect:false,collapsible:true,pagination:true,method:'get',pageSize:20,url:'*******',queryParams:{categoryId:0}">
<thead>
<tr>
<th data-options="field:'id',width:30">ID</th>
<th data-options="field:'title',width:120">内容标题</th>
<th data-options="field:'subTitle',width:100">内容子标题</th>
<th data-options="field:'pic',width:50,align:'center'">图片</th>
<th data-options="field:'created',width:130,align:'center'">创建日期</th>
<th data-options="field:'updated',width:130,align:'center'">更新日期</th>
</tr>
</thead>
</table>
接着在js写一个方法并引用
formatDateTime : function(val,row){
var now = new Date(val);
return now.format("yyyy-MM-dd hh:mm:ss");
}
最后在需要更改那一栏添加改方法
<th data-options="field:'created',width:130,align:'center',formatter:E3.formatDateTime">创建日期</th>
<th data-options="field:'updated',width:130,align:'center',formatter:E3.formatDateTime">更新日期</th>
效果如下:
End——————————————————————
最新文章
- VS2010中的查找和替换中正则的使用
- 转@ManyToMany- annotation关系映射篇(下)
- sql 邮件发送测试情况
- address
- iOS开发之如何修改Mac截屏保存路径
- Ubuntu配置LAMP+MediaWiki及常见问题
- Nginx 性能优化
- php 自带过滤和转义函数
- 1483:[HNOI]2009 梦幻布丁 - BZOJ
- Python顺序与range和random
- JSON 学习笔记
- SGU 415. Necessary Coins ( 背包dp )
- Dubbo(五) Dubbo入门demo——helloworld
- (最简单)红米手机5A的USB调试模式在哪里开启的方法
- 从数据库取出两个同样的字符串用equals比较返回false
- jqgrid表头上面再加一行---二级表头
- 洛谷P2257 YY的GCD
- [转]jvm加载类规则
- 洛谷 P2629 好消息,坏消息
- Managing DbContext the right way with Entity Framework 6: an in-depth guide by mehdime