我在Extjs网格中显示日期字段时遇到问题。我使用PHP来执行查询并以json格式返回我的数据。该数据库是SQL Server。日期将在json文件中返回: “TERMDATE”:{“date”:“2013-02-13 00:00:00”,“timezone_type”:3,“timezone”:“America / New_York”}
这只是日期字段,行中还有其他字段,它们都正常显示。 我只是想显示日期,我应该在我的php文件中做些什么,或者是否有办法将日期从发送的内容中拉出来。刷新网格时,日期字段显示为[对象对象]。
这是我的SQL语句:
SELECT CPK_USERS, FNAME, LNAME, STATUS, DEPARTMENT, Email, PHONE1, CellPhone, Work_Ext, HIREDATE, SUPERVISOR, TERMDATE FROM USERS where DELFLAG = 0 and CPK_USERS > 0 order by FNAME
这是以json格式返回的第一条记录:
{"succuss":true,"data":[{"CPK_USERS":153,"FNAME":"Aaron","LNAME":"Booth","STATUS":"Out","DEPARTMENT":"Customer Support","Email":"aaron.booth@xxxxx.com","PHONE1":"2134354709","CellPhone":"6357662738","Work_Ext":"550","HIREDATE":{"date":"2008-06-09 00:00:00","timezone_type":3,"timezone":"America\/New_York"},"SUPERVISOR":"","TERMDATE":{"date":"2013-02-13 00:00:00","timezone_type":3,"timezone":"America\/New_York"}},
我的模特:
Ext.define('DHS.model.dhsusers.User', {
extend: 'Ext.data.Model',
fields: [
{ name: 'CPK_USERS' },
{ name: 'FNAME' },
{ name: 'LNAME' },
{ name: 'STATUS' },
{ name: 'DEPARTMENT' },
{ name: 'Email' },
{ name: 'PHONE1' },
{ name: 'CellPhone' },
{ name: 'Work_Ext' },
{ name: 'HIREDATE' },
{ name: 'SUPERVISOR' },
{ name: 'TERMDATE' }
]
});
我的观点:
Ext.define('DHS.view.dhsusers.UserInfoList', {
extend: 'Ext.grid.Panel',
alias: 'widget.userinfolist',
frame: true,
store: Ext.create('DHS.store.dhsusers.UserInfo'),
columns:[
{text:"CPK_Users", dataIndex:'CPK_USERS', flex:1, hidden: true, hideable: false},
{text:"First Name", dataIndex:'FNAME', flex:1},
{text:"Last Name", dataIndex:'LNAME', flex:1},
{text:"Term Date", dataIndex:'TERMDATE', flex:1, type:'datecolumn'},
{text:"Email", dataIndex:'Email', flex:1},
{text:"Home Phone", dataIndex:'PHONE1', flex:1},
{text:"Cell", dataIndex:'CellPhone', flex:1},
{text:"Work Ext", dataIndex:'Work_Ext', flex:1}
]
});
答案 0 :(得分:0)
我猜你使用TERMDATE作为网格列,如果你使用TERMDATE.date(teorically),你会得到显示。但如果你分享更好的extjs代码。