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 ...
随机推荐
- $(QTDIR);$(QTDIR)\include\QtCore;$(QTDIR)\include;
$(QTDIR); 在系统环境变量中定义即可 vs属性中设置头文件路径
- EXISTS 和 IN 的区别
exists子句的用法 select * from 表1 where exists (select * from 表2 where 表1.列名=表2.列名); exists子句返回的结果并不是从数据库 ...
- 为什么要用jvm .
挚享科技 2018.4.8 运行java程序字节码,实现跨平台.. Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成 在Java虚拟机上运行的目标代码(字节码 ...
- java mail 读取邮件列表,
// 准备连接服务器的会话信息 Properties props = new Properties(); props.setProperty("mail.store.protocol&quo ...
- 常用jvm参数
如果你是Eclipse ,可以通过 run -> Run Configurations->Arguments 添加-XX:+PrintGCDetails 打开gc日志 -Xmx 设置jav ...
- msgs no .h file
1.单独编译包,catkin_make --pkg 包名,failed,则 2.进入build下对应的msgs包中,使用make,以及make install,failed,则 3.使用catkin_ ...
- SQL查找指定行的记录
select top 1 * from (select top 4 * from T_GasStationPrice order by EnableTime) a order by EnableTim ...
- java8 forEach Map List[转载]
java8 forEach 在Map和List中的使用 原始的使用 Map<String, Integer> items = new HashMap<>(); items.pu ...
- MathExam
MathExam 一.预估与实际 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 575 605 • Est ...
- Windows AD域管理软件