我在 Extjs 网格中显示日期字段时遇到问题。我正在使用 php 进行查询并以 json 格式返回我的数据。数据库是 SQL Server。日期在 json 文件中返回为: "TERMDATE":{"date":"2013-02-13 00:00:00","timezone_type":3,"timezone":"America/New_York"}
这只是日期字段,该行中还有其他字段,它们都正确显示。我只想显示日期,我应该在我的 php 文件中做某事,还是有办法从发送的内容中提取日期。刷新网格时,日期字段显示为 [object Object]。
这是我的 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}
]
});