zoukankan      html  css  js  c++  java
  • 使用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',30">ID</th>
       <th data-options="field:'title',120">内容标题</th>
       <th data-options="field:'subTitle',100">内容子标题</th>
       <th data-options="field:'pic',50,align:'center'">图片</th>
       <th data-options="field:'created',130,align:'center'">创建日期</th>
       <th data-options="field:'updated',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',130,align:'center',formatter:E3.formatDateTime">创建日期</th>

    <th data-options="field:'updated',130,align:'center',formatter:E3.formatDateTime">更新日期</th>

    效果如下:

    End——————————————————————

  • 相关阅读:
    森林 BZOJ 3123
    calc BZOJ 2655
    修路 BZOJ 4774
    无聊的计算器【数论多合一】
    矩阵乘法 BZOJ 2738
    K大数查询 BZOJ 3110
    发展城市 BZOJ 3700
    降雨量 BZOJ 1067
    chrome中showModalDialog解决方案
    MFC webbrowser读取文档的meta分析
  • 原文地址:https://www.cnblogs.com/wangxiaomo/p/11589883.html
Copyright © 2011-2022 走看看