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——————————————————————

  • 相关阅读:
    iOS new Date() 报invalid Date
    Windows查找端口对应进程
    Dbvisualizer Free版本无sql自动提示功能解决方案
    Docker
    更换k8s集群,或者创建集群使用用户不对,导致ranchar无法显示容器处理
    linux下mysql5.7.30安装
    ansible 使用redis缓存
    tr命令
    ipvsadm安装配置NAT
    2019新电脑主板安装win10系统
  • 原文地址:https://www.cnblogs.com/wangxiaomo/p/11589883.html
Copyright © 2011-2022 走看看