@{
ViewBag.Title = "Home Page";
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css">
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<table id="List" class="easyui-datagrid" style="width: auto; height: 350px;"></table> <script>
$(function () { $('#List').datagrid({
url: '@Url.Action("GetList")',
method: 'post',
fitColumns: true,
sortName: 'id',
sortOrder: 'asc',
idField: true,
striped: true,
singleSelect: true,
rownumbers: true,
columns: [[
{ field: 'id', title: 'ID', width: , align: 'center' },
{ field: 'email', title: '注册邮箱', width: , align: 'center' },
{ field: 'pwd', title: '密码', width: , align: 'center' },
{ field: 'time', title: '登录时间', width: , align: 'center', formatter: formatDate } ]]
});
});
function PrefixInteger(num, length) {
return (Array(length).join('') + num).slice(-length);
}
function formatDate(NewDtime) {
if (NewDtime == null || NewDtime == "")
return;
var dt = new Date(parseInt(NewDtime.slice(, )));
var year = dt.getFullYear();
var month = PrefixInteger(dt.getMonth() + ,);
var date = PrefixInteger(dt.getDate(),);
var hour = PrefixInteger(dt.getHours(),);
var minute = PrefixInteger(dt.getMinutes(),);
var second = PrefixInteger(dt.getSeconds(), );
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
}
</script>
</body> </html>
    public JsonResult GetList()
{
var user = new List<User>
{
new User {id= ,email="123@qq.com",pwd="",time=DateTime.Now },
new User {id= ,email="123@qq.com",pwd="",time=null }
};
return Json(user, JsonRequestBehavior.AllowGet);
}

EasyUI datagrid 序列 化后时间 处理 九的更多相关文章

  1. easyui datagrid 中序列化后的日期格式化

    1.在easyui datagrid 中序列化后的日期显示为:/Date(1433377800000)/ 2.格式化后的显示为: 2015-06-04 08:30:00 3.使用代码如下: 3.1. ...

  2. jquery easyui datagrid翻页后再查询始终从第一页开始

    在查询之前将datagrid的属性pageNumber重新设置为1 var opts = grid.datagrid('options'); opts.pageNumber = 1; easyui d ...

  3. easyUi DataGrid 显示日期列,时间为空也可,的正常显示,及普通居中列情况

    $('#tt').datagrid({                url: '@Url.Content("~/kpi/FindList")',                w ...

  4. EasyUI datagrid 日期时间格式化

    EasyUI datagrid中显示日期时间时,会显示为以下不太直观的数值: 添加以下JavaScript脚本,然后在field中添加 formatter: DateTimeFormatter 即可. ...

  5. 解决easyui datagrid load时缓存问题

    修改easyui datagrid内容保存后,使用$("#dg").datagrid("reload");或者$("#dg").datagr ...

  6. [转载]easyui datagrid 时间格化(JS 日期时间本地化显示)

    easyui datagrid 日期时间显示不正常,后台java 类型为 DATE 经过JSON工具一转化传到前台来就是这样,不便 于是想格式化一下, 格式化代码 如下: [javascript] v ...

  7. easyui datagrid 每条数据后添加操作按钮

    easyui datagrid 每条数据后添加“编辑.查看.删除”按钮 1.给datagrid添加操作字段:字段值 <table class="easyui-datagrid" ...

  8. 关于EasyUI DataGrid行编辑时嵌入时间控件

    本人做一个名为“安徽中控”项目时,为快速开发基础数据增删改模块,遂采用EasyUIDatagrid将所有增删改查的操作都集中于表格中,并且所有增删改查操作都集中于泛型对象,从而不必为每个表写具体的增删 ...

  9. EasyUI Datagrid Datetime(EasyUI DataGrid 时间格式化)

    EasyUI DataGrid 时间格式化 方法一: var Common = { //EasyUI用DataGrid用日期格式化 TimeFormatter: function (value, re ...

随机推荐

  1. Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

    从报错信息中,我们就可以分析出错误原因是触发了数据源的自动化配置,然而当前项目其实并不需要数据源.查其根源是依赖方提供的API依赖中引用了一些多余的依赖触发了该自动化配置的加载. 如何解决 为了解决上 ...

  2. NodeJS:(二)基础常用API

    node.js中文网:http://nodejs.cn/api/ (path.Buffer.events.fs) ①path路径-----const {resolve} = require('path ...

  3. sqlserver数据库中sql的使用

    目录: 1. 分组排序更新 2. 将查询结果插入到新的表中 3. 创建/更新存储过程 4. 创建/更新视图 5. 插入数据 6. 增加表格的列 7. 创建表格 8. 创建索引 9. 递归查询 1. 分 ...

  4. linux存储管理之自动挂在

    自动挂载 Automount ==================================================================================== ...

  5. ES6 4个方法

    var string = 'Yo' string.startsWith('Y')        -> true      startsWith()查找字符串是否是以某一个字段开始的 string ...

  6. 基于Python——实现两个文件夹中的文件拷贝

    [背景]当复制一个文件夹中的某文件到另一个文件夹中时是一件很容易的事情,可是如果存在很多文件夹中的文件需要一一拷贝,就会变的很繁琐,稍有不慎就会遗漏,今天就用Python来解决这个问题—— [代码实现 ...

  7. Python 同一文件中,有unittest不执行“if __name__ == '__main__”,不生成HTMLTestRunner测试报告的解决方案

    1.问题:Python中同一个.py文件中同时用unittest框架和HtmlReport框架后,HtmlReport不被执行. 2.为什么?其实不是HtmlReport不被执行,也不是HtmlRep ...

  8. .net core webapi带权限的文件下载方法

    众所周知,在webapi中,如果有个接口需要权限,一般会将带权限的字段塞进header中.但是,在带权限的文档下载接口中,无论是用post,还是get方式,我们无法设置header头信息.苦恼呀?别急 ...

  9. web.xml配置说明

    前言 首先,web.xml文件的作用是配置web项目启动时加载的信息.(web.xml并不是一个Web的必要文件,没有web.xml,网站仍然是可以正常工作的.) 而这些配置自然是通过标签来实现的, ...

  10. new 几种用法

    第一种:创建对象(运算符) 第二种:隐藏基类方法(  修饰符) 第三种:new约束指定泛型类声明中的任何类型参数都必须有公共的无参数构造函数 (泛型中的new()约束)