Extjs4 中date时间格式的问题
在Grid中显示时间,后台传过来的是date格式的数据(PHP date('Y-m-d', time()),一般在Ext model中定义数据的类型和格式:
{name:'birth', type:'date'},
view层:
{ header: '生日', dataIndex: 'birth', editor:{ xtype: 'datefield', format : 'Y-m-d'}}
但这是个可编辑的grid row,通过搜索得知,必须自己定义renderer,试过:
renderer:function(value) {
if(value instanceof Date) {
return new Date(value).format('Y-m-d');
} else {
return value;
}
}
在显示和编辑时候显示的是 2014-07-15这样的,但是在编辑状态为空,编辑完后显示为“Tue Jul 15 2014 08:00:00 GMT+0800 (中国标准时间)”,显然不符合。
再搜索,原来还有个util的类,专门是格式化数据的“Ext.util.Format”, view层代码修改为:
{ header: '生日', dataIndex: 'birth', editor:{ xtype: 'datefield', format : 'Y-m-d'}, renderer:new Ext.util.Format.dateRenderer('Y-m-d')}
即可正确显示‘Y-m-d’格式的时间。
Extjs4 中date时间格式的问题的更多相关文章
- SQL导入txt以及SQL中的时间格式操作
原文:SQL导入txt以及SQL中的时间格式操作 MySQL中导入txt的指令为: load data local infile "路径名称" into table "表 ...
- SpringMVC返回Json,自定义Json中Date类型格式
http://www.cnblogs.com/jsczljh/p/3654636.html —————————————————————————————————————————————————————— ...
- java中各种时间格式的转化
http://www.chinaitpower.com/A/2005-01-14/104881.html 使用java.util.Calendar返回间隔天数 static int g ...
- Angularjs中对时间格式:/Date(1448864369815)/ 的处理
注:本文使用的 angular 版本为 1.3 版 我们在后台对数据进行json序列化时,如果数据中包含有日期,序列化后返回到前端的结果可能是这样的: /Date(1448864369815)/ . ...
- 按照相应的格式获取系统时间并将其转化为SQL中匹配的(date)时间格式
在获取时间时需要对时间格式进行设置,此时就需要用到SimpleDateFormat 类 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM ...
- Newtonsoft.Json中的时间格式详解.
Newtonsoft.json是一款不错的序列化反序列化第三方组件,具体如何使用属于基础知识,此处不再讲解.看以下代码: public class OutgameEntity { public str ...
- JAVA中Sql时间格式与util时间格式转换
关于时间格式转化: java.util.Date 与 java.sql.Date 互换 sql是子类 字符串转化成java.util.Date SimpleDateFormat date =n ...
- 使用POI读取xlsx文件,包含对excel中自定义时间格式的处理
package poi; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundExcepti ...
- JAVA中通过时间格式来生成唯一的文件名
有时候我们需要截图,在要截图时,有人用到了时间格式,但是时间格式中的:在文件名称中是不被允许的字符,所以就会报错,如何生成唯一的时间文件名: package com.demo; import java ...
随机推荐
- PyQt4的一些问题汇总
(1)PyQt4获取中文路径名字乱码问题 网址可以参见:http://permalink.gmane.org/gmane.comp.python.chinese/9916 处理方式的代码可以参考如下 ...
- [Exception Android 19] - android.widget.HeaderViewListAdapter.isEnabled
java.lang.IndexOutOfBoundsException: Invalid index , size at java.util.ArrayList.throwIndexOutOfBoun ...
- android源代码分析 android toast使用具体解释 toast自己定义
在安卓开发过程中.toast使我们常常使用的一个类.当我们须要向用户传达一些信息,可是不须要和用户交互时,该方式就是一种十分恰当的途径. 我们习惯了这样使用toast:Toast.makeText(C ...
- 【DB2】If 'db2' is not a typo you can run the following command to lookup the package that contains the binary: command-not-found db2 bash: db2: command not found
数据库安装以后,db2报错如下: If 'db2' is not a typo you can run the following command to lookup the package that ...
- SuperMap iClient如何使用WMTS地图服务
SuperMap iClient如何使用WMTS地图服务 什么是WMTS服务 WMTS,切片地图Web服务(Web Map Tile Service)当前版本是1.0.0.该服务符合 OGC(Open ...
- vs2017安装过程问题及解决方法
1. 问题:C++ 无法打开 源 文件 "errno.h"等文件 解决方法:https://jingyan.baidu.com/article/8ebacdf0167b2249f6 ...
- mysql-multi source replication 配置
1.关键步骤 change master to master_host='172.16.192.201', master_port, master_user='repl', master_passwo ...
- 解决WinForm界面闪烁问题
前言 之前將.net 1.1 Windows Form程式升級到.net 4.0,結果在開畫面時,閃的非常利害! 於是就開始找解決方法. 研究及解決 開始找到了設定DoubleBuffer=true ...
- Atitit.减少http请求数方案
Atitit.减少http请求数方案 1. 原理与方法1 1.1. -------jsp1 1.2. "index/js.txt";2 1.3. connReduceDync2 1 ...
- hdoj 1053 Entropy(用哈夫曼编码)优先队列
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1053 讲解: 题意:给定一个字符串,根据哈夫曼编码求出最短长度,并求出比值. 思路:就是哈夫曼编码.把 ...