小编ozg*_*urc的帖子

ext js行扩展器日期格式渲染

我需要在网格上显示4个不同的日期字段.其中2个将直接显示为列,并且在展开行时所有这些都将可见.

我正在使用ExtJS 4.2.1

网格以我想要的格式显示日期(如27-12-2013 11:30),但我不能使扩展区域显示格式化日期.

  • 我试图将渲染器添加到模型字段
  • 我试图添加dateFormat/dateReadFormat + dateWriteFormat
  • 如果我不添加类型作为日期它写入java格式,否则标准日期格式如Fri Dec 20 2013 11:51:00 GMT + 0200(GTB标准时间)

我从java添加日期到Json,如下所示.

if(account.getCreated() != null)
                accountJson.put("created", new  SimpleDateFormat("yyyy/MM/dd hh:mm").format(account.getCreated()));

            if(account.getModified() != null)
                accountJson.put("modified", new  SimpleDateFormat("yyyy/MM/dd hh:mm").format(account.getModified()));

            if(account.getBeginDate() != null)
                accountJson.put("beginDate", new  SimpleDateFormat("yyyy/MM/dd hh:mm").format(account.getBeginDate()));

            if(account.getEndDate() != null)
                accountJson.put("endDate", new  SimpleDateFormat("yyyy/MM/dd hh:mm").format(account.getEndDate()));
Run Code Online (Sandbox Code Playgroud)

我的ext js字段:

........
{name: "created", type: 'date'},
{name: "modified", type: 'date'},
{name: "beginDate", type: 'date'},
{name: "endDate", type: 'date'} 
Run Code Online (Sandbox Code Playgroud)

网格列:

{text: 'Ba?lang?ç Tarihi',      sortable: true, dataIndex: 'beginDate', renderer: Ext.util.Format.dateRenderer('d-m-Y H:i')},
{text: 'Biti? Zaman?',          sortable: …
Run Code Online (Sandbox Code Playgroud)

javascript extjs date extjs4.2

2
推荐指数
1
解决办法
1228
查看次数

标签 统计

date ×1

extjs ×1

extjs4.2 ×1

javascript ×1