Extjs显示从数据库取出时间转换JSON后的出现问题
时间:2024-01-18 12:52:13
后台从数据库取出时间,JSON格式化后再传到gridpanel,这时时间变成了:/Date(32331121223)/这样的格式,那么这时需要以下处理才可以正常显示:
在
var record = Ext.data.Record.create([
{ name: 'PublicDate', mapping: 'PublicDate', dateFormat: 'Y-m-d', convert: function (v) {
if (v == null) {
return null;
}
var d = new Date();
var str = v.toString();
var str1 = str.replace("/Date(", "");
var str2 = str1.replace(")/", "");
var dd = parseInt(str2);
d.setTime(dd);
return d;
} }
]);
然后在:
var cm = new Ext.grid.ColumnModel([
{ header: '发布时间', dataIndex: 'PublicDate', width: 120, align: 'center', renderer: Ext.util.Format.dateRenderer('Y-m-d') }
]);
这样即可正常显示,如:2012-11-19,
标签:extjs,数据库,json
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
12个Pandas/NumPy中的加速函数使用总结
2022-10-27 13:52:25
Access 2002的三个实用技巧
2007-10-22 12:22:00
Python实现通讯录功能
2022-06-28 22:33:26
windows下pycharm安装、创建文件、配置默认模板
2023-11-25 03:30:26
![](https://img.aspxhome.com/file/2023/3/101263_0s.png)
Python中pymysql 模块的使用详解
2024-01-16 21:07:25
亚马逊购物用户体验分析(三)
2009-10-25 12:53:00
![](https://img.aspxhome.com/file/UploadPic/200910/25/navigational-elements-95s.jpg)
用Python中的字典来处理索引统计的方法
2022-05-28 19:43:45
go语言K8S 的 informer机制浅析
2024-05-13 10:44:51
![](https://img.aspxhome.com/file/2023/1/125081_0s.jpg)
Python+selenium实现截图图片并保存截取的图片
2023-06-03 10:15:59
pycharm设置鼠标悬停查看方法设置
2022-12-25 16:04:31
![](https://img.aspxhome.com/file/2023/2/69602_0s.png)
Window下安装JDK1.8+Tomcat9.0.27+Mysql5.7.28的教程图解
2024-01-26 22:24:12
![](https://img.aspxhome.com/file/2023/7/131857_0s.gif)
MySQL拼接字符串函数GROUP_CONCAT详解
2024-01-27 18:21:56
![](https://img.aspxhome.com/file/2023/3/124063_0s.png)
php 进阶:实现无限分类第1/4页
2023-11-17 21:04:55
PHP PDOStatement::fetchAll讲解
2023-06-14 15:54:26
vue货币过滤器的实现方法
2024-05-09 10:40:58
![](https://img.aspxhome.com/file/2023/6/126636_0s.jpg)
ASP连接11种数据库语法总结
2007-09-29 12:07:00
javascript实现依次输入input自动定焦
2024-04-28 10:19:12
![](https://img.aspxhome.com/file/2023/2/132692_0s.png)
将MSSQL Server 导入/导出到远程服务器教程的图文方法分享
2024-01-13 21:55:42
![](https://img.aspxhome.com/file/2023/6/110986_0s.gif)
php设计模式之正面模式实例分析【星际争霸游戏案例】
2023-11-14 10:54:04
python 定时器,轮询定时器的实例
2023-07-08 04:26:57