easyUi DataGrid 显示日期列,时间为空也可,的正常显示,及普通居中列情况
$('#tt').datagrid({
url: '@Url.Content("~/kpi/FindList")',
width: "auto",
height: "auto",
fitColumns: true,
nowrap: false,
pagination: true,
pageNumber: 1,
singleSelect: false,
frozenColumns: [[{ field: 'ck', checkbox: true}]],
columns: [[
普通列:
{ field: 'ProjectName', title: '项目名称', width: 120, align: 'center', styler: function (value, row, index) { return 'vertical-align:middle;'; } },
居中显示列:
{ field: 'Id', title: '任务号', align: 'center', width: 50, formatter: function (val, rec) {
return "<div class='hiddenFontGommom devicetypes_a_box' >" + rec.Id + "</div>";
}
},
时间显示列:
{ field: 'ImplementationBeginDate', title: '实施开始时间', align: 'center', width: 220, formatter: function (val, rec) {
var date = new Date(parseInt(rec.ImplementationBeginDate.substr(6)));
var dateTime = date.getFullYear() + "-" + ((date.getMonth() + 1).toString().length > 1 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-" + (date.getDate().toString().length > 1 ? date.getDate() : ("0" + date.getDate()))
+ " " + (date.getHours().toString().length > 1 ? date.getHours() : ("0" + date.getHours())) + ":" + (date.getMinutes().toString().length > 1 ? date.getMinutes() : ("0" + date.getMinutes())) + ":" + (date.getSeconds().toString().length > 1 ? date.getSeconds() : ("0" + date.getSeconds()));
return "<div class='hiddenFontGommom devicetypes_a_box' title=" + dateTime.replace(/ /g, " ") + ">" + dateTime + "</div>";
}
},
有时间为空的特殊时间显示列:
{ field: 'ImplementationEndDate', title: '实际完成时间', align: 'center', width: 220, formatter: function (val, rec) {
if (rec.ImplementationEndDate == null || rec.ImplementationEndDate == '') {
return "<div class='hiddenFontGommom devicetypes_a_box' ></div>";
}
else {
var date = new Date(parseInt(rec.ImplementationEndDate.substr(6)));
var dateTime = date.getFullYear() + "-" + ((date.getMonth() + 1).toString().length > 1 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-" + (date.getDate().toString().length > 1 ? date.getDate() : ("0" + date.getDate()))
+ " " + (date.getHours().toString().length > 1 ? date.getHours() : ("0" + date.getHours())) + ":" + (date.getMinutes().toString().length > 1 ? date.getMinutes() : ("0" + date.getMinutes())) + ":" + (date.getSeconds().toString().length > 1 ? date.getSeconds() : ("0" + date.getSeconds()));
return "<div class='hiddenFontGommom devicetypes_a_box' title=" + dateTime.replace(/ /g, " ") + ">" + dateTime + "</div>";
}
}
},
-------------------------
easyUi DataGrid 显示日期列,时间为空也可,的正常显示,及普通居中列情况的更多相关文章
- 在使用easyui,datagrid时,JSON中的如果含有换行符,则不能显示数据
http://www.xuebuyuan.com/2103538.html 每项值需处理换行符 item = item.Replace("\r\n", ""); ...
- DevExpress的DateEdit设置显示日期和时间
1. 设置Mask.EditMask和DisplayFormat,EditFormat属性.设置为一致:'yyyy-MM-dd HH:mm'; //依照想要的显示格式设置此字符串. [csharp] ...
- EasyUI datagrid 序列 化后时间 处理 九
@{ ViewBag.Title = "Home Page"; Layout = null; } <!DOCTYPE html> <html> <he ...
- mysql 使用 unix 方式显示日期和时间
1.UNIX中文为时间戳.该方式显示从1970年1月1日开始经过的秒数. 2.函数 UNIX_TIMESTAMP() 返回时间戳格式的时间, FROM_UNIXTIME() 将时间戳格式的时间转换为普 ...
- 【iCore3 双核心板】例程十:RTC实时时钟实验——显示日期和时间
实验指导书及代码包下载: http://pan.baidu.com/s/1jHuZcnc iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...
- 让 history 命令显示日期和时间
echo 'HISTTIMEFORMAT="%F %T "' >> /etc/profile source /etc/profile
- CentOS下date命令 - 显示和设置系统日期与时间
显示系统日期 要显示系统日期,只要输入: $ date Thu Dec 5 22:55:41 WIB 2013 格式化显示日期 日期有很多格式.如果你不喜欢默认的格式,你可以换一种格式.你可能会想&q ...
- Linux date命令 - 显示和设置系统日期与时间
操作系统上的时间也许只是当做一个时钟.特别在控制台下, 我们通常并不认为时间有什么重要的.但是对于管理员,这种认识是错误的.你知道错误的日期和时间会导致你不能编译程序么? 因为日期和时间很重要,这或许 ...
- Python学习笔记 (2) :字符串输出、操作、格式化和日期、时间格式化
一.字符串输出及运算 1.常用输出格式及方法 ')#单引号 ")#双引号 """)#三个引号 1234567890 1234567890 1234567890 ...
随机推荐
- jQuery操作(二)
一: 操作元素 1. 属性操作 1.1 $("p").text() $("p").html() $(":checkbox").val() 1 ...
- Ubuntu中文乱码问题解决方案
问题描述 在ubuntu上部署了jar包(java开发的图形界面),但是图形界面上的中文显示乱码. 采用以下步骤后你能够完美支持中文 第一步,安装中文支持包langauge-pack-zh-hans ...
- 实现SQL express版做自动备份数据库的方法
SQL Server 2005/2008 Express版没有代理组件,不支持维护计划.可以采用下面的办法实现每日备份: 一.在要备份的数据库中创建存储过程. 存储过程名称:sp_BackupData ...
- .net调用word转换pdf出现80080005错误的解决办法
检索 COM 类工厂中 CLSID 为 {000209FF-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80080005. 1:在服务器上安装offi ...
- php使用include报错require_once(../include.php): failed to open stream: No such file or directo
引入路径的问题,建议加入include_once $_SERVER['DOCUMENT_ROOT']."/include.php";意思是获取网站根目中的include.php 截 ...
- 2019.01.13 bzoj4538: [Hnoi2016]网络(树链剖分)
传送门 树链剖分一眼题. 题意简述: 给定一棵树,有三种操作: 加入一条路径 删除一条已加入的路径 询问不过一个点x的路径的最大值. 思路: 直接树链剖分维护答案. 因为询问的事不过点xxx的最大值, ...
- Linux 第三天
2.文件处理命令 1)touch 创建空文件 语法:touch文件名 2)cat 显示文件内容 英文原意:concatenate 语法:cat 文件名 常用选项: -n:number,显示行号 3)t ...
- 1.The Necessity of a Broad Education 全面教育的必要性
1.The Necessity of a Broad Education 全面教育的必要性 (1) According to a survey,which was based on the respo ...
- 代码的二次重构(开篇:JDBC连接数据库)
Java中使用JDBC连接数据库时,若是使用初级的代码,代码复用率非常低,连接过程简单来说分为以下几个步骤: 加载驱动包 准备好URL链接获取数据库连接(driver和url根据不同的数据库的不同而不 ...
- 第05章:MongoDB-CRUD操作--数据库
①显示现有的数据库 命令:show dbs 或者databases; ②显示当前的数据库 命令:db ③使用|创建数据库 命令:use 数据库名称 如果数据库不存在,则创建数据库,否则切换到指定数 ...